the-crypt/objects/Door.gd

28 lines
556 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 01:27:37 -05:00
if true:
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:44:41 -05:00
print(Player.current_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