–1 vote

My codes are not working, I'm sure that they are correct cause I copied them exactly from a tutorial but I'm gonna write them here anyway. The thing is even the print function worked at first but the second time I tried it I saw no output , so I guess they are not working. Btw, I'm new to GDscript or any game making stuff so please keep it simple :)
thank you :)

extends KinematicBody

var velocity = Vector3(0,0,0)
const SPEED = 5

func _ready():
    pass

func _physics_process(delta):
    if Input.is_action_pressed("ui_right") and Input.is_action_pressed("ui_left"):
        velocity.x = 0
    elif Input.is_action_pressed("ui_right"):
        velocity.x = SPEED
    elif Input.is_action_pressed("ui_left"):
        velocity.x = -SPEED
    else:
        velocity.x = lerp(velocity.x,0,0.1)

    if Input.is_action_pressed("ui_up") and Input.is_action_pressed("ui_down"):
        velocity.z = 0
    elif Input.is_action_pressed("ui_up"):
        velocity.z = SPEED
    elif Input.is_action_pressed("ui_down"):
        velocity.z = -SPEED
    else:
        velocity.z = lerp(velocity.z,0,0.1)
    move_and_slide(velocity)
Godot version 3.3.1
in Engine by (11 points)

What exactly is not working?
Also, what print? I didnt see any "print" calls in the code

Maybe your move_and_slide(velocity) function is not working

Have you set your Input Map in the project settings?
Can you also paste the errors that you get, because it's very hard to know what's wrong with just code alone.

Please log in or register to answer this question.

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.