Good day. Between your animations dissonance.
When your heroe jumping changes vector.y but vector.x = 0 and this is identically animation "Idle".
Based on your condition:
if isonfloor():
$AnimatedSprite.play("Jump")
But when you jumping you don't stayon floor. Invalid animation condition.
I would code it like this:
var const UP = Vector2(0, -1)
var const GRAVITY = 100
var const MAXSPEED = 100
var const MAXGRAVITY = 200
var const JUMPSPEED = 800
var movement = Vector2(ZERO)
func physicsprocess(delta):
movement = moveandslide(movement, UP)
movement.y += GRAVITY
if movement.y > MAXGRAVITY:
movement.y = MAXGRAVITY
move()
animation_update()
func move():
if Input.isactionpressed("uileft"):
movement.x = -MAXSPEED
elif Input.isactionpressed("uiright"):
movement.x = MAXSPEED
else:
movement.x = 0
if isonfloor():
if Input.isactionjustpressed("uiup"):
movement.y = -JUMPSPEED
func animationupdate():
isonfloor():
if movement.x != 0:
$AnimatedSprite.play("Walk")
elif movement.x == 0:
$AnimatedSprite.play("Idle")
ison_floor() == false:
if movement.y < 0:
$AnimatedSprite.play("Jump")
if movement.y > 0:
$AnimatedSprite.play("Fall")