shirogamis-maze/src/Objects/LockedDoor.gd

16 lines
389 B
GDScript3
Raw Normal View History

2021-05-27 01:44:39 -04:00
extends StaticBody2D
var done = false
export var item = "KeyYellow"
func _on_Area2D_body_entered(_body):
if !done and _body.name == "Player":
if global.has_item(item):
global.remove_item(item)
global.update_item_hud()
$AnimationPlayer.play("open")
done = true
else:
if global.hud.text_label.visible_characters == 0:
global.show_message("This gate needs a key.")