- RoomNavigator autoload: smooth camera pan between floors - Floor1 and Floor2 placeholder rooms with elevator buttons - CharacterData Resource with State enum (HEALTHY/SICK/SLEEPING/TIRED) - Character visual state feedback via ColorRect color - Main scene loads saved state on startup - SettingsMenu with music/sfx sliders and game reset - HUD settings button to open SettingsMenu Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
870 B
GDScript
31 lines
870 B
GDScript
## ElevatorButton — tappable button that navigates the camera to a target floor.
|
|
class_name ElevatorButton extends Node2D
|
|
|
|
@export var target_floor: int = 0
|
|
|
|
var _area: Area2D
|
|
|
|
|
|
func _ready() -> void:
|
|
_area = get_node_or_null("CollisionArea") as Area2D
|
|
if _area != null:
|
|
_area.input_event.connect(_on_input_event)
|
|
|
|
|
|
func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
|
_on_pressed()
|
|
elif event is InputEventScreenTouch and event.pressed:
|
|
_on_pressed()
|
|
|
|
|
|
func _on_pressed() -> void:
|
|
RoomNavigator.go_to_floor(target_floor)
|
|
_play_bounce()
|
|
|
|
|
|
func _play_bounce() -> void:
|
|
var tween: Tween = create_tween()
|
|
tween.tween_property(self, "scale", Vector2(1.15, 1.15), 0.08)
|
|
tween.tween_property(self, "scale", Vector2(1.0, 1.0), 0.08)
|