0 votes

I am working and when loading a scene it shows me the following error 0: 00: 00: 664 and 0: 00: 00: 0136 help me to fix it.

extends KinematicBody2D

const speed = 50

var anim = ""
var Animaction
var nira = ""

func ready():
Animacion = get
node("AnimationPlayer")
setphysicsprocess(true)

func fixedprocess(delta):
var direction = Vector2()
var new
anim = anim

if Input.is_action_pressed("ui_down"):
    direction.y += speed
    new_anim = "down"
    nira = "down"
elif Input.is_action_pressed("ui_up"):
    direction.y += -speed
    nira = "up"
elif Input.is_action_pressed("ui_left"):
    direction.x += -speed
    new_anim = "left"
    nira = "left"
elif Input.is_action_pressed("ui_right"):
    direction.x  += speed
    new_anim = "right"
    nira = "right"
else:
    new_anim = ""
    Animacion.stop();


if new_anim != anim:
    anim = new_anim
    Animaction.play(anim)

var movement = direction.normalized() * speed * delta
move(motion)
in Engine by (12 points)

you call fixed_process instead of _physics_process

go through your scripts and check for typos and such

Also, "0: 00: 00: 664" and "0: 00: 00: 0136" are not error codes; they're timestamps. The actual error message is displayed at the right of the timestamp.

1 Answer

0 votes

If you are trying to write some code to get your player to move along with an animated sprite, I can offer you mine. It works perfectly, you just need to changed the animated sprite "names" for it. If you are making a 2D game, I also have some code that flips the character and its animations depending on which way you are going.

extends KinematicBody2D

const SPEED = 250
const GRAVITY = 10
const GRAVITY2 = 100
const JUMP_POWER = -500
const FLOOR = Vector2(0, -1)

var velocity = Vector2()

var jump = false
var jump_speed = 10
var on_ground = false
var can_move = true
var is_attacking = false

func _physics_process(delta):
    if Input.is_action_pressed("forward"):
        if is_attacking == false || is_on_floor() == false:
            velocity.x = SPEED
            if is_attacking == false:
                $AnimatedSprite.play("run")
                $AnimatedSprite.flip_h = false
                if sign($Position2D.position.x) == -1:
                    $Position2D.position.x *= -1
    elif Input.is_action_pressed("backward"):
        if is_attacking == false || is_on_floor() == false:
            velocity.x = -SPEED
            if is_attacking == false:
                $AnimatedSprite.play("run")
                $AnimatedSprite.flip_h = true
                if sign($Position2D.position.x) == 1:
                    $Position2D.position.x *= -1
    else:
        velocity.x = 0
        if on_ground == true && is_attacking == false:
            $AnimatedSprite.play("idle")

    if Input.is_action_pressed("jump"):
        if is_attacking == false:
            if on_ground == true:
                velocity.y = JUMP_POWER
                $AnimatedSprite.play("jump")
                on_ground == false
by (50 points)
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 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 webmaster@godotengine.org with your username.