i tried to make it but i kinda messed it up, i have to press Shift first then A or D for code to switch to running State because i made in controls Shift + A/D instead of i just hold Shift while moving to run and let go to walk heres my code
var speed = Input.get_axis("Walk Left", "Walk Right")
if speed > 0:
animated_sprite.flip_h = false
$Ground.scale.x = 1
$AirHover.scale.x = 1
$AirForward.scale.x = 1
%CollisionShape2D.position.x = -41.0
elif speed < 0:
animated_sprite.flip_h = true
$Ground.scale.x = -1
$AirHover.scale.x = -1
$AirForward.scale.x = -1
%CollisionShape2D.position.x = -261.0
if is_on_floor():
velocity.x = speed * SPEED
if speed > 0 or speed < 0:
current_state = States.WALKING
if Input.get_axis("Run Left", "Run Right") and is_on_floor():
velocity.x = speed * RSPEED
if speed > 0 or speed < 0:
current_state = States.RUNNING
how to make that i hold shift run and let go get back to walking