You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
737 B
GDScript
34 lines
737 B
GDScript
extends CharacterBody3D
|
|
|
|
# need to do:
|
|
# direction -> $CharacterBody3D.position.z
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
var direction = Vector3.ZERO;
|
|
|
|
if Input.is_action_pressed("moveForward"):
|
|
direction.z -= 1
|
|
#print("forward")
|
|
velocity.z = direction.z;
|
|
move_and_slide();
|
|
|
|
if Input.is_action_pressed("moveBackward"):
|
|
direction.z += 1
|
|
velocity.z = direction.z;
|
|
move_and_slide();
|
|
|
|
if Input.is_action_pressed("moveLeft"):
|
|
direction.x -= 1;
|
|
velocity.x = direction.x;
|
|
move_and_slide();
|
|
|
|
if Input.is_action_pressed("moveRight"):
|
|
direction.x += 1;
|
|
velocity.x = direction.x;
|
|
move_and_slide();
|
|
|
|
if Input.is_action_pressed("moveJump"):
|
|
direction.y += 1;
|
|
velocity.y = velocity.y;
|
|
move_and_slide();
|