feat(poc): implement Sprint 1 proof of concept
- 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>
This commit is contained in:
30
scripts/autoload/InputManager.gd
Normal file
30
scripts/autoload/InputManager.gd
Normal file
@@ -0,0 +1,30 @@
|
||||
## 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)
|
||||
Reference in New Issue
Block a user