How can I stop the animation while it is the same

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Azar deeb

extends KinematicBody2D
var motion= Vector2(0,0)
export var speed = 400
export var gravity= 20
export var jump = -500
var double_jump = true
var Animation_Stop = 0
func _physics_process(delta):
gravity ()
func move():
if Input.is_action_pressed(“ui_left”):
if is_on_floor() :
Animation_Stop ++ 1
motion.x = -speed
$AnimatedSprite.flip_h = true
if Input.is_action_pressed(“ui_right”):
if is_on_floor():
Animation_Stop ++ 1
motion.x = speed
$AnimatedSprite.flip_h = false
else : motion.x = 0
if motion.x == 0 && Animation_Stop > 0:
func gravity ():
if !is_on_floor():
motion.y += gravity
elif is_on_floor():
double_jump = true
motion.y = gravity
if Input.is_action_just_pressed(“ui_up”):
motion.y = jump
if !is_on_floor() && motion.y > jump && double_jump == true && Input.is_action_just_pressed(“ui_up”):
motion.y = jump
double_jump = false


:bust_in_silhouette: Reply From: Gluon

If you want to set a particular frame do this

		$AnimatedSprite.frame = 0

change the frame number to whatever you want it to be but remember if somewhere else in your code you set it to play an animation again this basically wont be seen to work.