extends Control var ship_sprite: Sprite2D func _ready() -> void: if GameState.selected_ship_path.is_empty() or not ResourceLoader.exists(GameState.selected_ship_path): push_warning("Nie wybrano statku do nowej gry.") return var ship_texture := load(GameState.selected_ship_path) as Texture2D if ship_texture == null: push_warning("Nie udało się wczytać wybranego statku.") return ship_sprite = Sprite2D.new() ship_sprite.name = "PlayerShip" ship_sprite.texture = ship_texture add_child(ship_sprite) _update_ship_position() get_viewport().size_changed.connect(_update_ship_position) func _update_ship_position() -> void: if ship_sprite: ship_sprite.position = get_viewport_rect().size * 0.5