0 votes

I am new to godot and I love it so far but I am stuck. Code:

    extends KinematicBody

    onready var cam = get_node("Camera")

    var sens = 0.2

    var velocity = Vector3()
    const SPEED = 5

    func _ready():

    func _input(event):
        if event is InputEventMouseMotion:
            var movement = event.relative
            cam.rotation.x += -deg2rad(movement.y * sens)
            rotation.y += -deg2rad(movement.x * sens)

    func _physics_process(delta):
        if Input.is_key_pressed(KEY_ESCAPE):

        if Input.is_action_pressed("ui_left") and Input.is_action_pressed("ui_right"):
            velocity.z = 0
        elif Input.is_action_pressed("ui_left"):
            velocity.z = -SPEED
        elif Input.is_action_pressed("ui_right"):
            velocity.z = SPEED
            lerp(velocity.z, 0, 0.1)
            velocity.z = 0

       if Input.is_action_pressed("ui_up") and Input.is_action_pressed("ui_down"):
           velocity.x = 0
       elif Input.is_action_pressed("ui_up"):
           velocity.x = SPEED
       elif Input.is_action_pressed("ui_down"):
           lvelocity.x = -SPEED
            lerp(velocity.x, 0, 0.1)
            velocity.x = 0
in Engine by (32 points)
recategorized by

1 Answer

+1 vote
Best answer

This video tutorial might help. The Godot FPS tutorial also might help.

by (124 points)
selected by

Thanks alot!

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.