Godot Version
4.3
Question
Have a basic game that is supposed to become an fps later down the line. Right now I’m working on a crouching player state and I’m having trouble with shift (an input that isn’t referenced in the crouching player state) making me go to idle state if im still and walking if im moving.
func _update(delta):
PLAYER._update_gravity(delta)
PLAYER._update_input(SPEED, ACCELERATION, DECELERATION)
PLAYER._update_velocity(delta)
if Input.is_action_just_pressed("crouch"):
_uncrouch()
func _uncrouch():
ANIMATION.speed_scale = 1.0
if CROUCH_SHAPECAST.is_colliding() == false:
ANIMATION.play("crouch", -1.0, -CROUCH_SPEED, true)
await ANIMATION.animation_finished
if PLAYER.velocity.length() == 0:
transition.emit("IdlePlayerState")
else:
transition.emit("WalkingPlayerState")
elif CROUCH_SHAPECAST.is_colliding() == true:
await get_tree().create_timer(0.1).timeout
_uncrouch()