Ok so when my character jumps he only dose the first frame, and there's 3

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


extends KinematicBody2D

const SPEED = 400
const JUMP = -400
const GRAVITY = 20

const UP = Vector2(0, -1)
var motion = Vector2()

func _physics_process(delta):
motion.y += GRAVITY

if Input.is_action_pressed("RIGHT"):
	$AnimatedSprite.flip_h = false
	motion.x = SPEED
elif Input.is_action_pressed("LEFT"):
	$AnimatedSprite.flip_h = true
	motion.x = -SPEED
	motion.x = 0
if is_on_floor():
	if Input.is_action_just_pressed("JUMP"):
		motion.y = JUMP
motion = move_and_slide(motion, UP)
:bust_in_silhouette: Reply From: Inces

Play() functions means AnimationPlayer starts the process of animation from frame 0 to frame last in time given by the animation length. Think what can happen if You call play() every frame in physics_process(). It will endlessly jitter in frame 0 of course !
Design your code in a way animation play() is called only once. Look at your code - You already did it with jumping motion - it happens just once. Player rises up when he is on floor and jump is pressed, than he falls. He doesn’t jump endlessly above viewport. Use the same sollution to make your animation be played once