Files
Embodiment/Levels/Interactables/Silver Barrier.gd
2021-12-04 18:23:05 -06:00

24 lines
581 B
GDScript

extends StaticBody2D
export var alignment: String = 'V'
func _ready() -> void:
if not alignment in ['V', 'H']:
print('Silver Barrier rotation needs to be "V" or "H"')
elif alignment == 'H':
rotation_degrees = 90
return
func _on_unlock_body_entered(body: Node) -> void:
if not 'player' in body.get_groups():
return
if body.has_item('Silver Key'):
body.remove_item('Silver Key')
$Sprite.animation = 'open'
$Collision.set_deferred('disabled', true)
$Unlock.set_deferred('monitoring', false)
return