0 votes
extends KinematicBody

var vel = Vector3.ZERO
var frame = 0
var countingFrame = false

var gravity = 200
var speed = 200

onready var groundCheck = $GroundCheck

func _ready():
    pass

func _physics_process(_delta):
        vel = Vector3.ZERO
    frame += 1

    if frame > 15:
        frame = 1
        countingFrame = false

    if Input.is_action_pressed("forward") and frame % 15 == 0:
        vel.z -= speed
        countingFrame = true
    if Input.is_action_pressed("backward") and frame % 15 == 0:
        vel.z += speed
        countingFrame = true
    if Input.is_action_pressed("left") and frame % 15 == 0:
        vel.x -= speed
        countingFrame = true
    if Input.is_action_pressed("right") and frame % 15 == 0:
        vel.x += speed
        countingFrame = true


    move_and_slide(vel, Vector3.UP)

    print(str(translation))

    if Input.is_action_pressed("ui_cancel"):
        get_tree().quit()
Godot version 3.3.4
in Engine by (12 points)

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 webmaster@godotengine.org with your username.