- 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>
31 lines
872 B
GDScript
31 lines
872 B
GDScript
## InputManager — abstracts touch and mouse input into unified drag signals.
|
|
extends Node
|
|
|
|
signal drag_started(position: Vector2)
|
|
signal drag_moved(position: Vector2)
|
|
signal drag_ended(position: Vector2)
|
|
|
|
var _is_dragging: bool = false
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event is InputEventScreenTouch:
|
|
if event.pressed:
|
|
_is_dragging = true
|
|
drag_started.emit(event.position)
|
|
else:
|
|
_is_dragging = false
|
|
drag_ended.emit(event.position)
|
|
elif event is InputEventScreenDrag:
|
|
if _is_dragging:
|
|
drag_moved.emit(event.position)
|
|
elif event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
|
|
if event.pressed:
|
|
_is_dragging = true
|
|
drag_started.emit(event.position)
|
|
else:
|
|
_is_dragging = false
|
|
drag_ended.emit(event.position)
|
|
elif event is InputEventMouseMotion and _is_dragging:
|
|
drag_moved.emit(event.position)
|