Fixed going to wallslide from idle when landing

This commit is contained in:
Jakob Feldmann 2022-09-07 17:07:57 +02:00
parent d6d6301c7f
commit 38bf760182
2 changed files with 9 additions and 3 deletions

View File

@ -331,7 +331,8 @@ func execute_airstrafe(
delta
)
if linear_velocity.y > 0:
linear_velocity.y = 0
# TODO Put constant elsewhere
linear_velocity.y = linear_velocity.y * 0.33
air_strafe_charges -= 1
return linear_velocity
@ -348,8 +349,9 @@ func die() -> void:
# This problem stems from trying to decelerate a walk
# that was caused by the moving environment and not by input
# It is particularly usefull for moving floor physics
# TODO Setting y velocity this way stopped is_on_floor() from working correctly
func _on_Blobby_got_grounded() -> void:
velocity -= get_floor_velocity()
velocity.x -= get_floor_velocity().x
var floor_object = get_last_slide_collision().collider.get_parent()
if "slide_friction" in floor_object:
floor_friction = floor_object.slide_friction

View File

@ -162,6 +162,7 @@ func _get_transition(_delta):
elif parent.velocity.x != 0:
if Input.is_action_pressed("boost_move"):
new_state = states.run
# TODO Walking when stopping and not pressing anything?
else:
new_state = states.walk
if Input.is_action_pressed("duck"):
@ -180,6 +181,7 @@ func _get_transition(_delta):
func _enter_state(new_state, old_state):
print(new_state)
if old_state == "idle" && (new_state == "walk" || new_state == "run"):
init_boost = true
init_boost_type = old_state + "_" + new_state
@ -210,6 +212,8 @@ func _enter_state(new_state, old_state):
states.run:
anim_state_playback.travel("running")
states.wallslide:
# TODO When the hitbox transforms from wallslide to idle, blobby hangs in the air and that triggers the wallslide on landing
if(old_state != states.idle):
anim_state_playback.travel("wallsliding")