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-23 22:36:21 -05:00
|
|
|
export var text: String
|
2020-07-22 18:15:21 -05:00
|
|
|
|
|
|
|
onready var door = get_node("AnimationPlayer")
|
|
|
|
|
2020-07-23 22:36:21 -05:00
|
|
|
func _ready():
|
|
|
|
$CanvasLayer/Label.text = text
|
|
|
|
|
2020-07-22 18:15:21 -05:00
|
|
|
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-23 23:00:24 -05:00
|
|
|
$CanvasLayer/AnimationPlayer.play("fadeout")
|
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
|
|
|
|
2020-07-24 00:31:18 -05:00
|
|
|
func _on_x_timeout():
|
2020-07-23 22:36:21 -05:00
|
|
|
Player.current_scene = next_scene
|
|
|
|
get_tree().change_scene(""+next_scene+"")
|