![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Ouch_Bird |
The character is only moving on tick before it stops. Where did I bugger up the code?
extends KinematicBody
var gravity = Vector3.DOWN * 12
var speed = 4
var jump_speed = 6
var velocity = Vector3()
func _physics_process(delta):
velocity += gravity * delta
get_input()
velocity = move_and_slide(velocity, Vector3.UP)
func get_input():
velocity.x = 0
velocity.z = 0
if Input.is_action_just_pressed("move_forward"):
velocity.z -= speed
if Input.is_action_just_pressed("move_back"):
velocity.z += speed
if Input.is_action_just_pressed("strafe_right"):
velocity.x += speed
if Input.is_action_just_pressed("strafe_left"):
velocity.x -= speed