19 lines
494 B
GDScript3
Raw Normal View History

2024-12-27 21:00:07 +01:00
extends CharacterBody3D
const SPEED = 150.0
const JUMP_VELOCITY = 200
signal test
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
self.velocity.x = delta * SPEED * Input.get_axis("move_left", "move_right")
self.velocity.z = delta * SPEED * Input.get_axis("move_forward", "move_back")
if Input.is_key_pressed(KEY_SPACE) and is_on_floor():
self.velocity.y = delta * JUMP_VELOCITY
move_and_slide()