basic player movement

This commit is contained in:
Alexey 2025-07-15 20:14:27 +03:00
commit 2ce0a460ac
4 changed files with 58 additions and 7 deletions

View file

@ -1,12 +1,27 @@
extends RigidBody3D
extends CharacterBody3D
@export var speed = 100.0
@export var fall_acceleration = 75.0
var stack: CommandStack = CommandStack.new()
@onready var weapon_player: AnimationPlayer = $"HUD/Weapon/AnimationPlayer"
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
weapon_player.current_animation = "static"
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _physics_process(delta: float) -> void:
var direction = Vector3.ZERO
direction.z = Input.get_axis("move_forward", "move_backward")
direction.x = Input.get_axis("move_left", "move_right")
var target_velocity = direction * speed * delta
if not is_on_floor():
target_velocity.y -= fall_acceleration * delta
velocity = target_velocity
move_and_slide()