Shmup-01/scenes/player.gd
Henry 8501c18dd1 Configure project settings and import assets
This commit sets up the initial project configuration including: -
Window size and scaling settings - Input mappings for player controls -
Default texture filtering settings - Import of game asset pack with
sprites and UI elements - Set of signals for tracking player bullets
2025-10-13 09:24:17 +01:00

19 lines
542 B
GDScript

extends Area2D
@export var speed = 150
@onready var screensize = get_viewport_rect().size
func _process(delta):
var input = Input.get_vector("left", "right", "up", "down")
if input.x > 0:
$Ship.frame = 2
$Ship/Boosters.animation = "right"
elif input.x < 0:
$Ship.frame = 0
$Ship/Boosters.animation = "left"
else:
$Ship.frame = 1
$Ship/Boosters.animation = "forward"
position += input * speed * delta
position = position.clamp(Vector2(8, 8), screensize-Vector2(8, 8))