feat: add a chest node; add logic for random scroll in the chest; add a timer t hide the scroll after;

This commit is contained in:
2026-09-20 16:06:58 +02:00
parent d8d342ab56
commit fc007ca71a
6 changed files with 253 additions and 135 deletions
+23
View File
@@ -0,0 +1,23 @@
extends StaticBody2D
var can_interact: bool = false
var is_open: bool = false
@export var scrolls: Array[Sprite2D]
var scroll_number = 0
func _ready() -> void:
scroll_number = randi_range(1, 4)
func _process(delta: float) -> void:
if Input.is_action_just_pressed("Interact") and can_interact:
if !is_open:
$AudioStreamPlayer.play()
$AnimatedSprite2D.play("open")
scrolls[scroll_number].visible = true
$Timer.start()
is_open = true
func _on_timer_timeout(scroll_number: int) -> void:
scrolls[scroll_number].visible = false