- project.godot with autoload configuration - Reception room with placeholder visuals - Draggable Character with DragDropComponent - Interactive flower object with bounce animation - GameState, SaveManager, AudioManager, InputManager autoloads - HUD with back button and music toggle Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46 lines
1.2 KiB
GDScript
46 lines
1.2 KiB
GDScript
## GameState — global game state: character positions, object states, current room.
|
|
extends Node
|
|
|
|
signal state_changed
|
|
signal character_moved(character_id: String, position: Vector2)
|
|
|
|
var _character_positions: Dictionary = {}
|
|
var _object_states: Dictionary = {}
|
|
var current_room: String = "reception"
|
|
|
|
|
|
func get_character_position(id: String) -> Vector2:
|
|
return _character_positions.get(id, Vector2.ZERO)
|
|
|
|
|
|
func set_character_position(id: String, pos: Vector2) -> void:
|
|
_character_positions[id] = pos
|
|
character_moved.emit(id, pos)
|
|
state_changed.emit()
|
|
|
|
|
|
func get_object_state(id: String) -> String:
|
|
return _object_states.get(id, "idle")
|
|
|
|
|
|
func set_object_state(id: String, state: String) -> void:
|
|
_object_states[id] = state
|
|
state_changed.emit()
|
|
|
|
|
|
func get_save_data() -> Dictionary:
|
|
return {
|
|
"character_positions": _character_positions,
|
|
"object_states": _object_states,
|
|
"current_room": current_room,
|
|
}
|
|
|
|
|
|
func apply_save_data(data: Dictionary) -> void:
|
|
if data.has("character_positions"):
|
|
_character_positions = data["character_positions"]
|
|
if data.has("object_states"):
|
|
_object_states = data["object_states"]
|
|
if data.has("current_room"):
|
|
current_room = data["current_room"]
|