16 lines
389 B
GDScript3
16 lines
389 B
GDScript3
|
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.")
|