The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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
Godot version im using version 3.5
in Engine by (29 points)
if is_on_floor():
    if 0 == 0:  # ???? Problem is here
    # if motion.x == 0:

1 Answer

0 votes
Best answer
if is_on_floor():
    if 0 == 0:  # Change the first zero by "motion.x"
by (51 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.