so im making this mario bros thing and the walk animation is not working
extends KinematicBody2D
func _ready():
pass
var motion = Vector2()
var SPEED = 600
var JUMP_HEIGHT = -1000
var GRAVITY = 10
const FLOOR =Vector2(0, -1)
func _physics_process(delta):
motion.y += GRAVITY
if is_on_floor():
if Input.is_action_just_pressed("jump"):
motion.y = JUMP_HEIGHT
motion.y += GRAVITY
if Input.is_action_just_released("jump") && motion.y < 0:
motion.y = 0
if Input.is_action_pressed("left"):
motion.x = -SPEED
$Sprite.flip_h = true
elif Input.is_action_pressed("right"):
motion.x = SPEED
$Sprite.flip_h = false
else:
motion.x = 0
if is_on_floor():
if 0 == 0:
$AnimationPlayer.play("idle")
else:
$AnimationPlayer.play("walk")
else:
$AnimationPlayer.play("jumpin")
motion = move_and_slide(motion, FLOOR)
pass