Accuracy fixes + various bug fixes

Small patch time. There were a few glaring issues with the classic physics accuracy before. This commit tries to fix the majority of those issues.
- "Bounce Jump Speed" is changed from 248.0 -> 310.0. The reason for this is from a community poll which suggested that Bounce Speed be changed.
  - Due to how close the NES version was, I decided to only change "Bounce Jump Speed" meaning that classic physics technically will have both the NES and All-Stars bounce speeds, just depending on if you hold A or not. I think it feels nice this way and will do fine for now as a compromise until CharacterInfo variations can be implemented.
- Fixes:
  - Projectile and Particle file paths in the default POWER_PARAMS for Fire have been updated and should no longer cause issues with characters that don't set them.
  - You can no longer stand on the lip of the pipe in 1-2 that allows you to access the minus world.
- Accuracy changes:
  - Classic Physics "Ground Decel" lowered from 3.05 to 2.23, which matches closer to the original game's deceleration.
  - New parameter "Minimum Speed" which determines the minimum speed value the player can travel at when attempting to move.
  - New parameter "Run Stop Buffer" which determines how much time in seconds the player will continue running for if they
  - New parameter "Clamp Ground Speed" which clamps the player's movement speed based on their current target speed like the original SMB (i.e. if you run and jump while moving in the original, and let go of run, your character upon landing will instantly revert to max walking speed.)
  - New parameter "Can Run Accel Early" which allows the player to gain running acceleration and speed without needing to be at walk speed like the original SMB.
  - New parameter "Control Run Air Accel" for disabling the ability for the player to control their air speed once reaching running speed like the original SMB.
  - New parameter "Classic Skid Conditions" which attempts to replicate the same conditions required in the original SMB to start skidding. (This one needs more work, it isn't too accurate as of yet...)
This commit is contained in:
SkyanUltra 2025-11-22 23:46:51 -05:00
parent 17a4e04766
commit afcd70fb08
8 changed files with 3246 additions and 3162 deletions

View file

@ -32,20 +32,26 @@
"MAX_FALL_SPEED": 280.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": false,
"MINIMUM_SPEED": 0.0,
"WALK_SPEED": 96.0,
"GROUND_WALK_ACCEL": 4.0,
"WALK_SKID": 8.0,
"CAN_RUN_ACCEL_EARLY": false,
"RUN_STOP_BUFFER": 0.0,
"RUN_SPEED": 160.0,
"GROUND_RUN_ACCEL": 1.25,
"RUN_SKID": 8.0,
"CLASSIC_SKID_CONDITIONS": false,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 10.0,
"CAN_INSTANT_STOP_SKID": false,
"GROUND_DECEL": 3.0,
"LOCK_AIR_ACCEL": false,
"CONTROL_RUN_AIR_ACCEL": true,
"AIR_WALK_ACCEL": 3.0,
"AIR_RUN_ACCEL": 3.0,
"AIR_DECEL": 0.0,
@ -97,7 +103,7 @@
"CLASSIC_BOUNCE_BEHAVIOR": true,
"BOUNCE_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 310.0,
"FALL_GRAVITY_IDLE": 26.25,
"FALL_GRAVITY_WALK": 22.5,
@ -105,20 +111,26 @@
"MAX_FALL_SPEED": 255.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": true,
"MINIMUM_SPEED": 4.46,
"WALK_SPEED": 90.0,
"GROUND_WALK_ACCEL": 2.23,
"WALK_SKID": 6.1,
"CAN_RUN_ACCEL_EARLY": true,
"RUN_STOP_BUFFER": 0.167,
"RUN_SPEED": 150.0,
"GROUND_RUN_ACCEL": 3.34,
"RUN_SKID": 6.1,
"CLASSIC_SKID_CONDITIONS": true,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 33.75,
"CAN_INSTANT_STOP_SKID": true,
"GROUND_DECEL": 3.05,
"GROUND_DECEL": 2.23,
"LOCK_AIR_ACCEL": true,
"CONTROL_RUN_AIR_ACCEL": false,
"AIR_WALK_ACCEL": 2.23,
"AIR_RUN_ACCEL": 3.34,
"AIR_DECEL": 0.0,

View file

@ -32,20 +32,26 @@
"MAX_FALL_SPEED": 280.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": false,
"MINIMUM_SPEED": 0.0,
"WALK_SPEED": 96.0,
"GROUND_WALK_ACCEL": 4.0,
"WALK_SKID": 8.0,
"CAN_RUN_ACCEL_EARLY": false,
"RUN_STOP_BUFFER": 0.0,
"RUN_SPEED": 160.0,
"GROUND_RUN_ACCEL": 1.25,
"RUN_SKID": 8.0,
"CLASSIC_SKID_CONDITIONS": false,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 10.0,
"CAN_INSTANT_STOP_SKID": false,
"GROUND_DECEL": 3.0,
"LOCK_AIR_ACCEL": false,
"CONTROL_RUN_AIR_ACCEL": true,
"AIR_WALK_ACCEL": 3.0,
"AIR_RUN_ACCEL": 3.0,
"AIR_DECEL": 0.0,
@ -97,7 +103,7 @@
"CLASSIC_BOUNCE_BEHAVIOR": true,
"BOUNCE_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 310.0,
"FALL_GRAVITY_IDLE": 26.25,
"FALL_GRAVITY_WALK": 22.5,
@ -105,20 +111,26 @@
"MAX_FALL_SPEED": 255.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": true,
"MINIMUM_SPEED": 4.46,
"WALK_SPEED": 90.0,
"GROUND_WALK_ACCEL": 2.23,
"WALK_SKID": 6.1,
"CAN_RUN_ACCEL_EARLY": true,
"RUN_STOP_BUFFER": 0.167,
"RUN_SPEED": 150.0,
"GROUND_RUN_ACCEL": 3.34,
"RUN_SKID": 6.1,
"CLASSIC_SKID_CONDITIONS": true,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 33.75,
"CAN_INSTANT_STOP_SKID": true,
"GROUND_DECEL": 3.05,
"GROUND_DECEL": 2.23,
"LOCK_AIR_ACCEL": true,
"CONTROL_RUN_AIR_ACCEL": false,
"AIR_WALK_ACCEL": 2.23,
"AIR_RUN_ACCEL": 3.34,
"AIR_DECEL": 0.0,

View file

@ -32,20 +32,26 @@
"MAX_FALL_SPEED": 280.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": false,
"MINIMUM_SPEED": 0.0,
"WALK_SPEED": 96.0,
"GROUND_WALK_ACCEL": 4.0,
"WALK_SKID": 8.0,
"CAN_RUN_ACCEL_EARLY": false,
"RUN_STOP_BUFFER": 0.0,
"RUN_SPEED": 160.0,
"GROUND_RUN_ACCEL": 1.25,
"RUN_SKID": 8.0,
"CLASSIC_SKID_CONDITIONS": false,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 10.0,
"CAN_INSTANT_STOP_SKID": false,
"GROUND_DECEL": 3.0,
"LOCK_AIR_ACCEL": false,
"CONTROL_RUN_AIR_ACCEL": true,
"AIR_WALK_ACCEL": 3.0,
"AIR_RUN_ACCEL": 3.0,
"AIR_DECEL": 0.0,
@ -97,7 +103,7 @@
"CLASSIC_BOUNCE_BEHAVIOR": true,
"BOUNCE_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 310.0,
"FALL_GRAVITY_IDLE": 26.25,
"FALL_GRAVITY_WALK": 22.5,
@ -105,20 +111,26 @@
"MAX_FALL_SPEED": 255.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": true,
"MINIMUM_SPEED": 4.46,
"WALK_SPEED": 90.0,
"GROUND_WALK_ACCEL": 2.23,
"WALK_SKID": 6.1,
"CAN_RUN_ACCEL_EARLY": true,
"RUN_STOP_BUFFER": 0.167,
"RUN_SPEED": 150.0,
"GROUND_RUN_ACCEL": 3.34,
"RUN_SKID": 6.1,
"CLASSIC_SKID_CONDITIONS": true,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 33.75,
"CAN_INSTANT_STOP_SKID": true,
"GROUND_DECEL": 3.05,
"GROUND_DECEL": 2.23,
"LOCK_AIR_ACCEL": true,
"CONTROL_RUN_AIR_ACCEL": false,
"AIR_WALK_ACCEL": 2.23,
"AIR_RUN_ACCEL": 3.34,
"AIR_DECEL": 0.0,

View file

@ -32,20 +32,26 @@
"MAX_FALL_SPEED": 280.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": false,
"MINIMUM_SPEED": 0.0,
"WALK_SPEED": 96.0,
"GROUND_WALK_ACCEL": 4.0,
"WALK_SKID": 8.0,
"CAN_RUN_ACCEL_EARLY": false,
"RUN_STOP_BUFFER": 0.0,
"RUN_SPEED": 160.0,
"GROUND_RUN_ACCEL": 1.25,
"RUN_SKID": 8.0,
"CLASSIC_SKID_CONDITIONS": false,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 10.0,
"CAN_INSTANT_STOP_SKID": false,
"GROUND_DECEL": 3.0,
"LOCK_AIR_ACCEL": false,
"CONTROL_RUN_AIR_ACCEL": true,
"AIR_WALK_ACCEL": 3.0,
"AIR_RUN_ACCEL": 3.0,
"AIR_DECEL": 0.0,
@ -97,7 +103,7 @@
"CLASSIC_BOUNCE_BEHAVIOR": true,
"BOUNCE_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 248.0,
"BOUNCE_JUMP_SPEED": 310.0,
"FALL_GRAVITY_IDLE": 26.25,
"FALL_GRAVITY_WALK": 22.5,
@ -105,20 +111,26 @@
"MAX_FALL_SPEED": 255.0,
"CEILING_BUMP_SPEED": 45.0,
"CLAMP_GROUND_SPEED": true,
"MINIMUM_SPEED": 4.46,
"WALK_SPEED": 90.0,
"GROUND_WALK_ACCEL": 2.23,
"WALK_SKID": 6.1,
"CAN_RUN_ACCEL_EARLY": true,
"RUN_STOP_BUFFER": 0.167,
"RUN_SPEED": 150.0,
"GROUND_RUN_ACCEL": 3.34,
"RUN_SKID": 6.1,
"CLASSIC_SKID_CONDITIONS": true,
"SKID_THRESHOLD": 100.0,
"SKID_STOP_THRESHOLD": 33.75,
"CAN_INSTANT_STOP_SKID": true,
"GROUND_DECEL": 3.05,
"GROUND_DECEL": 2.23,
"LOCK_AIR_ACCEL": true,
"CONTROL_RUN_AIR_ACCEL": false,
"AIR_WALK_ACCEL": 2.23,
"AIR_RUN_ACCEL": 3.34,
"AIR_DECEL": 0.0,

File diff suppressed because it is too large Load diff

View file

@ -40,20 +40,26 @@ extends CharacterBody2D
"MAX_FALL_SPEED": 280.0, # The player's maximum fall speed, measured in px/sec.
"CEILING_BUMP_SPEED": 45.0, # The speed at which the player falls after hitting a ceiling, measured in px/sec.
"CLAMP_GROUND_SPEED": false, # Determines if the player's speed will get clamped while moving on the ground, emulating snappier movement.
"MINIMUM_SPEED": 0.0, # The player's minimum speed while actively moving.
"WALK_SPEED": 96.0, # The player's speed while walking, measured in px/sec.
"GROUND_WALK_ACCEL": 4.0, # The player's acceleration while walking, measured in px/frame.
"WALK_SKID": 8.0, # The player's turning deceleration while running, measured in px/frame.
"CAN_RUN_ACCEL_EARLY": false, # Determines if the player can hold run before reaching walk speed to begin running.
"RUN_STOP_BUFFER": 0.0, # Determines the amount of time in seconds before running will stop once its initiated.
"RUN_SPEED": 160.0, # The player's speed while running, measured in px/sec.
"GROUND_RUN_ACCEL": 1.25, # The player's acceleration while running, measured in px/frame.
"RUN_SKID": 8.0, # The player's turning deceleration while running, measured in px/frame.
"CLASSIC_SKID_CONDITIONS": false, # Determines if the player's speed must be over SKID_THRESHOLD to begin skidding.
"SKID_THRESHOLD": 100.0, # The horizontal speed required, to be able to start skidding.
"SKID_STOP_THRESHOLD": 10.0, # The maximum velocity required before the player will stop skidding.
"CAN_INSTANT_STOP_SKID": false, # Determines if the player will instantly stop upon reaching the skid threshold.
"GROUND_DECEL": 3.0, # The player's grounded deceleration while no buttons are pressed, measured in px/frame.
"LOCK_AIR_ACCEL": false, # Determines if the player can surpass their walk speed while in the air, aside from on trampolines.
"CONTROL_RUN_AIR_ACCEL": true, # Determines if the player must be holding the run button to allow for running speed in the air.
"AIR_WALK_ACCEL": 3.0, # The player's acceleration while in midair, measured in px/frame.
"AIR_RUN_ACCEL": 3.0, # The player's acceleration while in midair, measured in px/frame.
"AIR_DECEL": 0.0, # The player's airborne deceleration while no buttons are pressed, measured in px/frame.
@ -106,7 +112,7 @@ extends CharacterBody2D
"CLASSIC_BOUNCE_BEHAVIOR": true, # Determines if the player can only get extra height from a bounce with upward velocity, as opposed to holding jump.
"BOUNCE_SPEED": 248.0, # The strength at which the player bounces off enemies without any extra input, measured in px/sec.
"BOUNCE_JUMP_SPEED": 248.0, # The strength at which the player bounces off enemies while holding jump, measured in px/sec.
"BOUNCE_JUMP_SPEED": 310.0, # The strength at which the player bounces off enemies while holding jump, measured in px/sec.
"FALL_GRAVITY_IDLE": 26.25, # The player's gravity while falling from an idle state, measured in px/frame.
"FALL_GRAVITY_WALK": 22.5, # The player's gravity while falling from a walking state, measured in px/frame.
@ -114,20 +120,26 @@ extends CharacterBody2D
"MAX_FALL_SPEED": 255.0, # The player's maximum fall speed, measured in px/sec.
"CEILING_BUMP_SPEED": 45.0, # The speed at which the player falls after hitting a ceiling, measured in px/sec.
"CLAMP_GROUND_SPEED": true, # Determines if the player's speed will get clamped while moving on the ground, emulating snappier movement.
"MINIMUM_SPEED": 4.46, # The player's minimum speed while actively moving.
"WALK_SPEED": 90.0, # The player's speed while walking, measured in px/sec.
"GROUND_WALK_ACCEL": 2.23, # The player's acceleration while walking, measured in px/frame.
"WALK_SKID": 6.1, # The player's turning deceleration while running, measured in px/frame.
"CAN_RUN_ACCEL_EARLY": true, # Determines if the player can hold run before reaching walk speed to begin running.
"RUN_STOP_BUFFER": 0.167, # Determines the amount of time in seconds before running will stop once its initiated.
"RUN_SPEED": 150.0, # The player's speed while running, measured in px/sec.
"GROUND_RUN_ACCEL": 3.34, # The player's acceleration while running, measured in px/frame.
"RUN_SKID": 6.1, # The player's turning deceleration while running, measured in px/frame.
"CLASSIC_SKID_CONDITIONS": true, # Determines if the player's speed must be over SKID_THRESHOLD to begin skidding.
"SKID_THRESHOLD": 100.0, # The horizontal speed required, to be able to start skidding.
"SKID_STOP_THRESHOLD": 33.75, # The maximum velocity required before the player will stop skidding.
"CAN_INSTANT_STOP_SKID": true, # Determines if the player will instantly stop upon reaching the skid threshold.
"GROUND_DECEL": 3.05, # The player's grounded deceleration while no buttons are pressed, measured in px/frame.
"GROUND_DECEL": 2.23, # The player's grounded deceleration while no buttons are pressed, measured in px/frame.
"LOCK_AIR_ACCEL": true, # Determines if the player can surpass their walk speed while in the air, aside from on trampolines.
"CONTROL_RUN_AIR_ACCEL": false, # Determines if the player must be holding the run button to allow for running speed in the air.
"AIR_WALK_ACCEL": 2.23, # The player's acceleration while in midair, measured in px/frame.
"AIR_RUN_ACCEL": 3.34, # The player's acceleration while in midair, measured in px/frame.
"AIR_DECEL": 0.0, # The player's airborne deceleration while no buttons are pressed, measured in px/frame.
@ -202,8 +214,8 @@ extends CharacterBody2D
},
"Big": {},
"Fire": {
"PROJ_TYPE": "Entities/Items/Fireball",
"PROJ_PARTICLE": "Particles/FireballExplosion",
"PROJ_TYPE": "res://Scenes/Prefabs/Entities/Items/Fireball",
"PROJ_PARTICLE": "res://Scenes/Prefabs/Particles/FireballExplosion",
},
}
## Determines values involving various ending sequences, such as grabbing the flagpole and walking to an NPC at the end of a level.
@ -503,7 +515,6 @@ func _ready() -> void:
$Checkpoint/Label.modulate = [Color("5050FF"), Color("F73910"), Color("1A912E"), Color("FFB762")][player_id]
$Checkpoint/Label.visible = Global.connected_players > 1
character = CHARACTERS[int(Global.player_characters[player_id])]
apply_character_physics()
apply_character_sfx_map()
Global.can_pause = true
@ -673,7 +684,6 @@ func _physics_process(delta: float) -> void:
if not is_actually_on_floor() and not just_landed:
can_land_sfx = true
handle_water_detection()
handle_move_fx()
const BUBBLE_PARTICLE = preload("uid://bwjae1h1airtr")
@ -718,6 +728,7 @@ func summon_bubble() -> void:
func _process(delta: float) -> void:
handle_power_up_states(delta)
handle_invincible_palette()
handle_move_fx()
if is_invincible:
DiscoLevel.combo_meter = 100

View file

@ -109,9 +109,7 @@ var audio_override_queue := []
func play_sfx(stream_name = "", position := Vector2.ZERO, pitch := 1.0, can_overlap := true) -> void:
if sfx_library.has(stream_name): # SkyanUltra: Simple check that allows for custom optional sounds.
if not can_overlap and active_sfxs.has(stream_name):
return
if queued_sfxs.has(stream_name):
if (not can_overlap and active_sfxs.has(stream_name)) or queued_sfxs.has(stream_name):
return
queued_sfxs.append(stream_name)
if stream_name is String:
@ -135,7 +133,6 @@ func play_sfx(stream_name = "", position := Vector2.ZERO, pitch := 1.0, can_over
add_child(player)
active_sfxs[stream_name] = player
queued_sfxs.erase(stream_name)
#print(active_sfxs)
await player.finished
active_sfxs.erase(stream_name)
player.queue_free()

View file

@ -6,6 +6,8 @@ var jump_queued := false
var jump_buffer := 0
var run_buffer := 0
var walk_frame := 0
var bubble_meter := 0.0
@ -34,8 +36,11 @@ func handle_death_pits() -> void:
func handle_movement(delta: float) -> void:
jump_buffer -= 1
run_buffer -= 1
if jump_buffer <= 0:
jump_queued = false
if Global.player_action_pressed("run", player.player_id):
run_buffer = player.physics_params("RUN_STOP_BUFFER") / delta
player.apply_gravity(delta)
if player.is_actually_on_floor():
var player_transform = player.global_transform
@ -97,10 +102,11 @@ func grounded(delta: float) -> void:
AudioManager.kill_sfx("look_up")
func handle_ground_movement(delta: float) -> void:
var skid_conditions = sign(player.input_direction * player.velocity_direction) < 0.0 and abs(player.velocity.x) > player.physics_params("SKID_THRESHOLD") if not player.physics_params("CLASSIC_SKID_CONDITIONS") else sign(player.direction * player.velocity_direction) < 0.0
if player.skidding:
ground_skid(delta)
elif sign(player.input_direction * player.velocity_direction) < 0.0 and abs(player.velocity.x) > player.physics_params("SKID_THRESHOLD") and not player.crouching:
player.skidding = true
elif not player.crouching and skid_conditions:
player.skidding = true # TODO: player skids regardless of current input direction, add it as a param
elif player.input_direction != 0 and not player.crouching:
ground_acceleration(delta)
else:
@ -111,7 +117,8 @@ func ground_acceleration(delta: float) -> void:
if player.in_water or player.flight_meter > 0:
target_move_speed = player.physics_params("SWIM_GROUND_SPEED")
var target_accel: float = player.physics_params("GROUND_WALK_ACCEL")
if (Global.player_action_pressed("run", player.player_id) and abs(player.velocity.x) >= player.physics_params("WALK_SPEED")) and (not player.in_water and player.flight_meter <= 0) and player.can_run:
var walk_speed_requirement = abs(player.velocity.x) >= player.physics_params("WALK_SPEED") if not player.physics_params("CAN_RUN_ACCEL_EARLY") else true
if ((Global.player_action_pressed("run", player.player_id) or run_buffer > 0) and walk_speed_requirement) and (not player.in_water and player.flight_meter <= 0) and player.can_run:
target_move_speed = player.physics_params("RUN_SPEED")
target_accel = player.physics_params("GROUND_RUN_ACCEL")
if player.input_direction != player.velocity_direction:
@ -119,7 +126,10 @@ func ground_acceleration(delta: float) -> void:
target_accel = player.physics_params("RUN_SKID")
else:
target_accel = player.physics_params("WALK_SKID")
player.velocity.x = move_toward(player.velocity.x, target_move_speed * player.input_direction, (target_accel / delta) * delta)
var clamp_values = [-target_move_speed, target_move_speed] if player.physics_params("CLAMP_GROUND_SPEED") else [-INF, INF]
player.velocity.x = clamp(move_toward(player.velocity.x, target_move_speed * player.input_direction, (target_accel / delta) * delta), clamp_values[0], clamp_values[1])
if abs(player.velocity.x) < player.physics_params("MINIMUM_SPEED"):
player.velocity.x = player.physics_params("MINIMUM_SPEED") * player.input_direction
func deceleration(delta: float, airborne := false) -> void:
var decel_type = player.physics_params("GROUND_DECEL") if not airborne else player.physics_params("AIR_DECEL")
@ -147,7 +157,7 @@ func in_air() -> void:
func handle_air_movement(delta: float) -> void:
if player.input_direction != 0 and player.velocity_direction != player.input_direction:
air_skid(delta)
if player.input_direction != 0:
elif player.input_direction != 0:
air_acceleration(delta)
else:
deceleration(delta, true)
@ -159,20 +169,38 @@ func handle_air_movement(delta: float) -> void:
player.gravity = player.calculate_speed_param("FALL_GRAVITY")
func air_acceleration(delta: float) -> void:
var backwards_accel = player.physics_params("AIR_BACKWARDS_ACCEL_MULT") if sign(player.velocity.x * player.direction) < 0.0 else 1
var backwards_accel = 1
if sign(player.velocity.x * player.direction) < 0.0:
backwards_accel = player.physics_params("AIR_BACKWARDS_ACCEL_MULT")
elif sign(player.input_direction * player.direction) < 0.0:
backwards_accel = 1 / player.physics_params("AIR_BACKWARDS_ACCEL_MULT")
var target_speed = player.physics_params("WALK_SPEED")
var target_accel = player.physics_params("AIR_WALK_ACCEL") * backwards_accel
var lock_air_speed = (abs(player.velocity.x) > player.physics_params("WALK_SPEED") or player.has_spring_jumped) if player.physics_params("LOCK_AIR_ACCEL") else abs(player.velocity.x) >= player.physics_params("WALK_SPEED")
if lock_air_speed and Global.player_action_pressed("run", player.player_id) and player.can_run:
var air_accel_control = Global.player_action_pressed("run", player.player_id) and player.can_run if player.physics_params("CONTROL_RUN_AIR_ACCEL") else true
if lock_air_speed and air_accel_control:
target_speed = player.physics_params("RUN_SPEED")
target_accel = player.physics_params("AIR_RUN_ACCEL") * backwards_accel
if not player.physics_params("CAN_BACKWARDS_ACCEL_RUN") and sign(player.velocity.x * player.direction) < 0.0:
target_accel = player.physics_params("AIR_WALK_ACCEL") * backwards_accel
print([target_speed, target_accel, player.physics_params("CAN_BACKWARDS_ACCEL_RUN")])
player.velocity.x = move_toward(player.velocity.x, target_speed * player.input_direction, (target_accel / delta) * delta)
func air_skid(delta: float) -> void:
player.velocity.x = move_toward(player.velocity.x, 1 * player.input_direction, (player.physics_params("AIR_SKID") / delta) * delta)
var backwards_accel = 1
if sign(player.velocity.x * player.direction) < 0.0:
backwards_accel = player.physics_params("AIR_BACKWARDS_ACCEL_MULT")
elif sign(player.input_direction * player.direction) < 0.0:
backwards_accel = 1 / player.physics_params("AIR_BACKWARDS_ACCEL_MULT")
var target_speed = player.physics_params("WALK_SPEED")
var target_accel = player.physics_params("AIR_SKID") * backwards_accel
var lock_air_speed = (abs(player.velocity.x) > player.physics_params("WALK_SPEED") or player.has_spring_jumped) if player.physics_params("LOCK_AIR_ACCEL") else abs(player.velocity.x) >= player.physics_params("WALK_SPEED")
var air_accel_control = Global.player_action_pressed("run", player.player_id) and player.can_run if player.physics_params("CONTROL_RUN_AIR_ACCEL") else true
if lock_air_speed and air_accel_control:
target_speed = player.physics_params("RUN_SPEED")
target_accel = player.physics_params("AIR_SKID") * backwards_accel
if not player.physics_params("CAN_BACKWARDS_ACCEL_RUN") and sign(player.velocity.x * player.direction) < 0.0:
target_accel = player.physics_params("AIR_SKID") * backwards_accel
player.velocity.x = move_toward(player.velocity.x, target_speed * player.input_direction, (target_accel / delta) * delta)
func handle_swimming(delta: float) -> void:
bubble_meter += delta