feat: add closed door node; add 2 new signals to puzzleButton node; connected signals to lockedDoor node;

This commit is contained in:
2026-09-18 20:52:17 +02:00
parent 0d6bfd6e90
commit 4234167cc1
5 changed files with 44 additions and 2 deletions
+5 -2
View File
@@ -1,5 +1,8 @@
extends Area2D
var bodies_on_top = 0
signal pressed
signal unpressed
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
@@ -14,11 +17,11 @@ func _on_body_entered(body: Node2D) -> void:
bodies_on_top = bodies_on_top + 1
if (body.is_in_group("pushable") or body is Player) and bodies_on_top == 1:
$AnimatedSprite2D.play("pressed")
print("PRESSED!")
pressed.emit()
func _on_body_exited(body: Node2D) -> void:
bodies_on_top = bodies_on_top - 1
if (body.is_in_group("pushable") or body is Player) and bodies_on_top == 0:
$AnimatedSprite2D.play("unpressed")
print("UNPRESSED!")
unpressed.emit()