Hello,
I have resumed my work on my game. But since I'm new to GDScript, I still have a lot to learn.
Now, I want to move my character while it undergoes animation.
I have used the Animated Sprite node to create a running animation. But the script I have used is for controlling the animation, so when I leave the button needed to animate the character, the animation stops (not completed).
This is the script, taken from the Godot Docs:
extends KinematicBody2D
onready var _animated_sprite = $AnimatedSprite
func _process(_delta):
if Input.is_action_pressed("ui_right"):
_animated_sprite.play("run")
else:
_animated_sprite.stop()
The animation is titled 'run'. As mentioned above, this one's used for controlling. I need a code for complete animation on one press (no holding). Additionally, I need code required to move the character while it is animated by X-axis distance. Since, I am not much experienced with GDScript, I really need help.
Thank you for reading.