初始化提交

This commit is contained in:
des
2026-01-04 19:35:08 +08:00
commit 89e0b55794
24 changed files with 371 additions and 0 deletions

29
palyer.gd Normal file
View File

@@ -0,0 +1,29 @@
extends CharacterBody3D
var speed = 14
var fall_acceleration = 75
var target_velocity = Vector3.ZERO
func _physics_process(delta: float):
var direction = Vector3.ZERO
if Input.is_action_pressed("move_forward"):
direction.z -= 1
if Input.is_action_pressed("move_back"):
direction.z += 1
if Input.is_action_pressed("move_left"):
direction.x -= 1
if Input.is_action_pressed("move_right"):
direction.x += 1
if direction != Vector3.ZERO:
direction = direction.normalized()
$pivot.basis = Basis.looking_at(direction)
target_velocity.x = direction.x * speed
target_velocity.z = direction.z * speed
if !is_on_floor():
target_velocity.y = target_velocity.y - ( fall_acceleration * delta )
velocity = target_velocity
move_and_slide()