![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Callmejhed |
I’m new to Godot and in this small plat former I’m making i want to create a slide action that would move the sprite a specific distance at a specific speed while making it perform it’s slide animation throughout the duration of the slide but all I’ve gotten so far is a continuous sliding motion that will continue so long as the action is pressed. (P.S I’m trying to make it so the slide happens if the analog stick is flicked on controller/ button is pressed on keyboard and can’t be done in procession i.e You have to finish the “get_up” sequence to be able to slide again.)
Here’s the function i wrote for the sliding
func slide_mechanics():
if Input.is_action_pressed("slide_left"):
$Sprite.flip_h = true
$Sprite.play("Slide")
velocity.x = -DODGE_SPEED
elif Input.is_action_pressed("slide_right"):
$Sprite.flip_h = false
$Sprite.play("Slide")
velocity.x = DODGE_SPEED
$Sprite.play("Get_up")