mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Merge upstream before Koopa scoring PR
This commit is contained in:
@@ -158,7 +158,12 @@ func apply_properties(properties := {}) -> void:
|
||||
if property_node == null:
|
||||
return
|
||||
for i in properties.keys():
|
||||
property_node.set(i, properties[i])
|
||||
if property_node.get(i) is Vector2:
|
||||
var value = properties[i]
|
||||
if value is Array:
|
||||
property_node.set(i, Vector2(value[0], value[1]))
|
||||
else:
|
||||
property_node.set(i, properties[i])
|
||||
|
||||
func get_variation_json(json := {}) -> Dictionary:
|
||||
var level_theme = Global.level_theme
|
||||
|
@@ -131,6 +131,10 @@ func _ready() -> void:
|
||||
$Info.hide()
|
||||
%Grid.hide()
|
||||
play_level()
|
||||
_physics_process(0)
|
||||
set_physics_process(false)
|
||||
for i in [$TileMenu]:
|
||||
i.queue_free()
|
||||
else:
|
||||
Global.current_game_mode = Global.GameMode.LEVEL_EDITOR
|
||||
else:
|
||||
@@ -147,7 +151,8 @@ func _physics_process(delta: float) -> void:
|
||||
handle_tile_cursor()
|
||||
if [EditorState.IDLE, EditorState.TRACK_EDITING].has(current_state):
|
||||
handle_camera(delta)
|
||||
%ThemeName.text = Global.level_theme
|
||||
if is_instance_valid(%ThemeName):
|
||||
%ThemeName.text = Global.level_theme
|
||||
handle_hud()
|
||||
if Input.is_action_just_pressed("editor_open_menu"):
|
||||
if current_state == EditorState.IDLE:
|
||||
|
@@ -17,8 +17,8 @@ func _physics_process(delta: float) -> void:
|
||||
velocity.y += (15 / delta) * delta
|
||||
velocity.y = clamp(velocity.y, -INF, 150)
|
||||
if is_on_floor():
|
||||
velocity.y = -150
|
||||
if is_on_wall() or is_on_ceiling():
|
||||
velocity.y = -125
|
||||
if is_on_wall() or (abs(get_floor_normal().x) > 0 and is_on_ceiling()):
|
||||
hit()
|
||||
move_and_slide()
|
||||
|
||||
|
@@ -1,24 +1,41 @@
|
||||
class_name Player
|
||||
extends CharacterBody2D
|
||||
|
||||
var AIR_ACCEL := 3.0
|
||||
var AIR_SKID := 1.5
|
||||
var DECEL := 3.0
|
||||
var FALL_GRAVITY := 25.0
|
||||
var GROUND_RUN_ACCEL := 1.25
|
||||
var GROUND_WALK_ACCEL := 4.0
|
||||
var JUMP_GRAVITY := 11.0
|
||||
var JUMP_HEIGHT := 300.0
|
||||
var JUMP_INCR := 8.0
|
||||
var SWIM_GRAVITY := 2.5
|
||||
var SWIM_SPEED := 95.0
|
||||
var MAX_FALL_SPEED := 280
|
||||
var MAX_SWIM_FALL_SPEED := 200
|
||||
var RUN_SKID := 8.0
|
||||
var RUN_SPEED := 160
|
||||
var WALK_SKID := 8.0
|
||||
var WALK_SPEED := 96.0
|
||||
var CEILING_BUMP_SPEED := 45.0
|
||||
#region Physics properies, these can be changed within a custom character's CharacterInfo.json
|
||||
var JUMP_GRAVITY := 11.0 # The player's gravity while jumping, measured in px/frame
|
||||
var JUMP_HEIGHT := 300.0 # The strength of the player's jump, measured in px/sec
|
||||
var JUMP_INCR := 8.0 # How much the player's X velocity affects their jump speed
|
||||
var JUMP_CANCEL_DIVIDE := 1.5 # When the player cancels their jump, their Y velocity gets divided by this value
|
||||
var JUMP_HOLD_SPEED_THRESHOLD := 0.0 # When the player's Y velocity goes past this value while jumping, their gravity switches to FALL_GRAVITY
|
||||
|
||||
var BOUNCE_HEIGHT := 200.0 # The strength at which the player bounces off enemies, measured in px/sec
|
||||
var BOUNCE_JUMP_HEIGHT := 300.0 # The strength at which the player bounces off enemies while holding jump, measured in px/sec
|
||||
|
||||
var FALL_GRAVITY := 25.0 # The player's gravity while falling, measured in px/frame
|
||||
var MAX_FALL_SPEED := 280.0 # The player's maximum fall speed, measured in px/sec
|
||||
var CEILING_BUMP_SPEED := 45.0 # The speed at which the player falls after hitting a ceiling, measured in px/sec
|
||||
|
||||
var WALK_SPEED := 96.0 # The player's speed while walking, measured in px/sec
|
||||
var GROUND_WALK_ACCEL := 4.0 # The player's acceleration while walking, measured in px/frame
|
||||
var WALK_SKID := 8.0 # The player's turning deceleration while running, measured in px/frame
|
||||
|
||||
var RUN_SPEED := 160.0 # The player's speed while running, measured in px/sec
|
||||
var GROUND_RUN_ACCEL := 1.25 # The player's acceleration while running, measured in px/frame
|
||||
var RUN_SKID := 8.0 # The player's turning deceleration while running, measured in px/frame
|
||||
|
||||
var DECEL := 3.0 # The player's deceleration while no buttons are pressed, measured in px/frame
|
||||
var AIR_ACCEL := 3.0 # The player's acceleration while in midair, measured in px/frame
|
||||
var AIR_SKID := 1.5 # The player's turning deceleration while in midair, measured in px/frame
|
||||
|
||||
var SWIM_SPEED := 95.0 # The player's horizontal speed while swimming, measured in px/sec
|
||||
var SWIM_GROUND_SPEED := 45.0 # The player's horizontal speed while grounded underwater, measured in px/sec
|
||||
var SWIM_HEIGHT := 100.0 # The strength of the player's swim, measured in px/sec
|
||||
var SWIM_GRAVITY := 2.5 # The player's gravity while swimming, measured in px/frame
|
||||
var MAX_SWIM_FALL_SPEED := 200.0 # The player's maximum fall speed while swimming, measured in px/sec
|
||||
|
||||
var DEATH_JUMP_HEIGHT := 300.0 # The strength of the player's "jump" during the death animation, measured in px/sec
|
||||
#endregion
|
||||
|
||||
@onready var camera_center_joint: Node2D = $CameraCenterJoint
|
||||
|
||||
@onready var sprite: AnimatedSprite2D = %Sprite
|
||||
@@ -125,7 +142,7 @@ const ANIMATION_FALLBACKS := {
|
||||
"WaterIdle": "Idle",
|
||||
"DieFreeze": "Die",
|
||||
"StarJump": "Jump",
|
||||
"StarFall": "JumpFall"
|
||||
"StarFall": "StarJump"
|
||||
}
|
||||
|
||||
var palette_transform := true
|
||||
@@ -272,12 +289,8 @@ func apply_gravity(delta: float) -> void:
|
||||
if in_water or flight_meter > 0:
|
||||
gravity = SWIM_GRAVITY
|
||||
else:
|
||||
if gravity_vector.y > 0:
|
||||
if velocity.y > 0:
|
||||
gravity = FALL_GRAVITY
|
||||
elif gravity_vector.y < 0:
|
||||
if velocity.y < 0:
|
||||
gravity = FALL_GRAVITY
|
||||
if sign(gravity_vector.y) * velocity.y + JUMP_HOLD_SPEED_THRESHOLD > 0.0:
|
||||
gravity = FALL_GRAVITY
|
||||
velocity += (gravity_vector * ((gravity / (1.5 if low_gravity else 1.0)) / delta)) * delta
|
||||
var target_fall: float = MAX_FALL_SPEED
|
||||
if in_water:
|
||||
@@ -369,11 +382,11 @@ func enemy_bounce_off(add_combo := true, award_score := true) -> void:
|
||||
jump_cancelled = not Global.player_action_pressed("jump", player_id)
|
||||
await get_tree().physics_frame
|
||||
if Global.player_action_pressed("jump", player_id):
|
||||
velocity.y = -300
|
||||
velocity.y = sign(gravity_vector.y) * -BOUNCE_JUMP_HEIGHT
|
||||
gravity = JUMP_GRAVITY
|
||||
has_jumped = true
|
||||
else:
|
||||
velocity.y = -200
|
||||
velocity.y = sign(gravity_vector.y) * -BOUNCE_HEIGHT
|
||||
|
||||
func add_stomp_combo(award_score := true) -> void:
|
||||
if stomp_combo >= 10:
|
||||
|
@@ -66,6 +66,9 @@ var sky_scroll_speed := -4.0
|
||||
|
||||
const disco_sfx_threshold := [0.05, 0.5, 0.8]
|
||||
|
||||
var primary_layer_size = Vector2(512, 512)
|
||||
var secondary_layer_size = Vector2(512, 512)
|
||||
var sky_layer_size = Vector2(512, 512)
|
||||
|
||||
func set_second_y_offset(value := 0.0) -> void:
|
||||
second_layer_offset.y = -value
|
||||
@@ -188,6 +191,10 @@ func update_visuals() -> void:
|
||||
$SecondaryLayer/Mushrooms.get_node("Tint").visible = can_mushroom_tint
|
||||
$SecondaryLayer/Trees.get_node("Tint").visible = can_tree_tint
|
||||
|
||||
$PrimaryLayer.repeat_size = primary_layer_size
|
||||
$SecondaryLayer.repeat_size = secondary_layer_size
|
||||
$SkyLayer.repeat_size = sky_layer_size
|
||||
|
||||
var tree_tint_amount = inverse_lerp(1, 0, parallax_amount)
|
||||
var mushroom_tint_amount = tree_tint_amount
|
||||
if can_mushroom_tint == false:
|
||||
|
@@ -61,7 +61,8 @@ var file := {
|
||||
"bridge_animation": 0,
|
||||
"visible_timers": 0,
|
||||
"transition_animation": 0,
|
||||
"colour_pipes": 1
|
||||
"colour_pipes": 1,
|
||||
"firebar_style": 0
|
||||
},
|
||||
"difficulty":
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@ func enter(msg := {}) -> void:
|
||||
player.set_collision_mask_value(i + 1, false)
|
||||
player.gravity = player.JUMP_GRAVITY
|
||||
if msg["Pit"] == false:
|
||||
player.velocity.y = -300
|
||||
player.velocity.y = -player.DEATH_JUMP_HEIGHT
|
||||
|
||||
func physics_update(delta: float) -> void:
|
||||
if can_fall:
|
||||
|
@@ -95,7 +95,7 @@ func handle_ground_movement(delta: float) -> void:
|
||||
func ground_acceleration(delta: float) -> void:
|
||||
var target_move_speed := player.WALK_SPEED
|
||||
if player.in_water or player.flight_meter > 0:
|
||||
target_move_speed = 45
|
||||
target_move_speed = player.SWIM_GROUND_SPEED
|
||||
var target_accel := player.GROUND_WALK_ACCEL
|
||||
if (Global.player_action_pressed("run", player.player_id) and abs(player.velocity.x) >= player.WALK_SPEED) and (not player.in_water and player.flight_meter <= 0) and player.can_run:
|
||||
target_move_speed = player.RUN_SPEED
|
||||
@@ -133,14 +133,9 @@ func handle_air_movement(delta: float) -> void:
|
||||
|
||||
if Global.player_action_pressed("jump", player.player_id) == false and player.has_jumped and not player.jump_cancelled:
|
||||
player.jump_cancelled = true
|
||||
if player.gravity_vector.y > 0:
|
||||
if player.velocity.y < 0:
|
||||
player.velocity.y /= 1.5
|
||||
player.gravity = player.FALL_GRAVITY
|
||||
elif player.gravity_vector.y < 0:
|
||||
if player.velocity.y > 0:
|
||||
player.velocity.y /= 1.5
|
||||
player.gravity = player.FALL_GRAVITY
|
||||
if sign(player.gravity_vector.y * player.velocity.y) < 0.0:
|
||||
player.velocity.y /= player.JUMP_CANCEL_DIVIDE
|
||||
player.gravity = player.FALL_GRAVITY
|
||||
|
||||
func air_acceleration(delta: float) -> void:
|
||||
var target_speed = player.WALK_SPEED
|
||||
@@ -171,7 +166,7 @@ func swim_acceleration(delta: float) -> void:
|
||||
func swim_up() -> void:
|
||||
if player.swim_stroke:
|
||||
player.play_animation("SwimIdle")
|
||||
player.velocity.y = -100 * player.gravity_vector.y
|
||||
player.velocity.y = -player.SWIM_HEIGHT * player.gravity_vector.y
|
||||
AudioManager.play_sfx("swim", player.global_position)
|
||||
swim_up_meter = 0.5
|
||||
player.crouching = false
|
||||
|
@@ -7,10 +7,17 @@ static var character_icons := [preload("res://Assets/Sprites/Players/Mario/LifeI
|
||||
|
||||
const RANK_COLOURS := {"F": Color.DIM_GRAY, "D": Color.WEB_MAROON, "C": Color.PALE_GREEN, "B": Color.DODGER_BLUE, "A": Color.RED, "S": Color.GOLD, "P": Color.PURPLE}
|
||||
|
||||
var delta_time := 0.0
|
||||
|
||||
func _ready() -> void:
|
||||
Global.level_theme_changed.connect(update_character_info)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
func _process(delta: float) -> void:
|
||||
if not get_tree().paused and $Timer.paused:
|
||||
delta_time += delta
|
||||
if delta_time >= 1:
|
||||
delta_time -= 1
|
||||
on_timeout()
|
||||
handle_main_hud()
|
||||
handle_pausing()
|
||||
|
||||
@@ -20,7 +27,7 @@ func handle_main_hud() -> void:
|
||||
$Main/RedCoins.hide()
|
||||
$Main/CoinCount.show()
|
||||
%Combo.hide()
|
||||
|
||||
$Timer.paused = Settings.file.difficulty.time_limit == 2
|
||||
$%Time.show()
|
||||
%Stopwatch.hide()
|
||||
%PB.hide()
|
||||
@@ -173,7 +180,7 @@ func activate_pause_menu() -> void:
|
||||
const HURRY_UP = preload("res://Assets/Audio/BGM/HurryUp.mp3")
|
||||
|
||||
func on_timeout() -> void:
|
||||
if Global.can_time_tick and is_instance_valid(Global.current_level) and Settings.file.difficulty.time_limit == 1:
|
||||
if Global.can_time_tick and is_instance_valid(Global.current_level) and Settings.file.difficulty.time_limit > 0:
|
||||
if Global.level_editor != null:
|
||||
if Global.level_editor.current_state != LevelEditor.EditorState.PLAYTESTING:
|
||||
return
|
||||
|
Reference in New Issue
Block a user