the-crypt/objects/Door.gd

27 lines
528 B
GDScript3
Raw Normal View History

2020-07-22 18:15:21 -05:00
extends Sprite
export var unlocked: bool = true
2020-07-23 01:27:37 -05:00
export var next_scene: String
2020-07-22 18:15:21 -05:00
onready var door = get_node("AnimationPlayer")
func _process(delta):
if $Area2D.get_overlapping_bodies().size() != 0:
2020-07-23 11:36:28 -05:00
if unlocked:
2020-07-22 23:57:55 -05:00
$Label.text = "F to Open"
2020-07-23 01:10:01 -05:00
if Input.is_action_just_pressed("open"):
2020-07-22 23:57:55 -05:00
Player.current_scene = next_scene
2020-07-23 01:10:01 -05:00
get_tree().change_scene(""+next_scene+"")
2020-07-22 23:57:55 -05:00
else:
$Label.text = "Locked"
$Label.visible = true
else:
$Label.visible = false
func lock():
unlocked = false
func unlock():
unlocked = true
2020-07-22 18:15:21 -05:00