All of my other animations are working expect "jump", does anyone have any ideas?

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

extends KinematicBody2D

const UP = Vector2(0,-1)
const GRAVITY = 13
const MAXFALLSPEED = 200
const MAXSPEED = 80
const JUMPFORCE = 300
const ACELL = 10

var motion = Vector2()
var facing_right = true

func _ready():
pass # Replace with function body.

func _physics_process(delta):

motion.y += GRAVITY
if motion.y > MAXFALLSPEED:
	motion.y = MAXFALLSPEED
	
if facing_right == true:
	$Sprite.scale.x = 1
else:
	$Sprite.scale.x = -1

motion.x = clamp(motion.x,-MAXSPEED,MAXSPEED)

if Input.is_action_pressed("right"):
	motion.x += ACELL
	facing_right=true
	$AnimationPlayer.play("Run")
elif Input.is_action_pressed("left"):
	motion.x -= ACELL
	facing_right=false
	$AnimationPlayer.play("Run")
else:
	motion.x = lerp(motion.x,0,0.2)
	$AnimationPlayer.play("Ilde")
	
if is_on_floor():
	if Input.is_action_just_pressed("up"):
		motion.y = -JUMPFORCE
if !is_on_floor():
	if motion.y < 0:
		$AnimationPlayer.play("Jump")
	elif motion.y > 0:
		$AnimationPlayer.play("Fall")
motion = move_and_slide(motion,UP)
:bust_in_silhouette: Reply From: Inces

You mean player is not jumping and not animated ?
Show code for setting “is_on_floor” boolean

Or You mean player is jumping and not animated ?
That is because every frame You force the other 3 animations - left, right and idle. They are connected with all-time if statement , while jumping animation has a split frame to work - on action just pressed. So it works for one frame and is invisible for human eye, because in the next frame IDLE is forced again.

:bust_in_silhouette: Reply From: DaddyMonster

Could be loads of things. Add a print / line break to $AnimationPlayer.play("Jump") and confirm it’s evaluating true. Check the name of the animation. Check it runs in the editor. Check it’s set to the beginning (if it’s at the end then playing won’t do anything).

I’d strongly recommend that you use AnimationTree. It’s one of the most powerful tools Godot offers. Takes a little getting used to but once you’re up to speed with it you’ll never dream of running animations without it. Up to you whether you use a state machine or a BlendTree - with the latter you can link your animations to the output node via a TimeScale and a “seek” so it’s easy to reset it in the editor.

Good luck!