- 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>
29 lines
824 B
GDScript
29 lines
824 B
GDScript
## Character — base class for all playable figures (bunny, cat, etc.).
|
|
class_name Character extends Node2D
|
|
|
|
signal character_picked_up(character: Character)
|
|
signal character_placed(character: Character, position: Vector2)
|
|
|
|
@export var character_id: String = ""
|
|
@export var display_name: String = ""
|
|
|
|
var _is_held: bool = false
|
|
|
|
|
|
func _ready() -> void:
|
|
var drag: DragDropComponent = get_node_or_null("DragDropComponent") as DragDropComponent
|
|
if drag != null:
|
|
drag.drag_picked_up.connect(_on_drag_picked_up)
|
|
drag.drag_released.connect(_on_drag_released)
|
|
|
|
|
|
func _on_drag_picked_up(_pos: Vector2) -> void:
|
|
_is_held = true
|
|
character_picked_up.emit(self)
|
|
|
|
|
|
func _on_drag_released(pos: Vector2) -> void:
|
|
_is_held = false
|
|
GameState.set_character_position(character_id, global_position)
|
|
character_placed.emit(self, pos)
|