Blobby/src/Contraptions/GateBlock.gd

22 lines
550 B
GDScript

extends StaticBody2D
onready var signalManager := get_tree().root.get_child(3).get_node("%SignalManager")
onready var levelState := get_tree().root.get_child(3).get_node("%LevelState")
export var locked := true
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
signalManager.connect("unlocked", self, "unlock")
# if locked:
# $CollisionShape2D.enabled = true
# visible = true
func unlock(key: String) -> void:
if key.to_lower() == "gateblock":
$CollisionShape2D.disabled = true
visible = false