Files
A Thousand Ships 0343cedd48 General proofreading (#1262)
* General proofreading for grammar and spelling
* General formatting
* Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
2025-10-11 01:39:59 -07:00

23 lines
512 B
GDScript

extends CharacterBody3D
# Moves the player
@export_range(1, 2) var player_id := 1
@export var walk_speed := 2.0
func _physics_process(_delta: float) -> void:
var move_direction := Input.get_vector(
"move_left_player" + str(player_id),
"move_right_player" + str(player_id),
"move_up_player" + str(player_id),
"move_down_player" + str(player_id),
)
velocity.x += move_direction.x * walk_speed
velocity.z += move_direction.y * walk_speed
# Apply friction.
velocity *= 0.9
move_and_slide()