Files
arco/scripts/spaceship.gd
T
nerpa a40afb5463
CI / Test (pull_request) Successful in 21s
feat: spaceship scene
- add input map for WASD control
- add script for "smooth" movement
2026-05-15 16:20:58 +03:00

16 lines
375 B
GDScript

extends CharacterBody2D
@export var thrust := 500.0
@export var friction := 0.98
@export var max_speed := 1000.0
func _physics_process(delta: float) -> void:
var direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
#
velocity += direction * thrust * delta
velocity *= friction
velocity = velocity.limit_length(max_speed)
move_and_slide()