Add spaceship interaction components and update player movement logic

This commit is contained in:
2025-05-25 19:26:41 +02:00
parent 129fc17f13
commit bac0a8c5f7
19 changed files with 286 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ extends CharacterBody2D
@export var default_movement_type: String = "platform"
@export var movement_types: Dictionary = {}
@export var ship_sprite: Sprite2D
var current_movement: PlayerMovement = null
signal movement_switched(movement_type: String)
@@ -50,3 +51,14 @@ func get_next_movement_type() -> String:
current_index = (current_index + 1) % keys.size()
return keys[current_index]
func on_spaceship_entered() -> void:
switch_movement("ship")
ship_sprite.visible = true
func on_spaceship_exited() -> void:
switch_movement(default_movement_type)
ship_sprite.visible = false