Rooms can now be locked down and open when all enemies are killed
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
extends Node
|
||||
|
||||
@export var room_lockdown : bool = false
|
||||
|
||||
var enemies = []
|
||||
var doors = []
|
||||
var room_checks = []
|
||||
@@ -16,7 +18,10 @@ func _ready():
|
||||
doors.append(i)
|
||||
if i.is_in_group("room_check"):
|
||||
room_checks.append(i)
|
||||
i.room_entered.connect(room_entered)
|
||||
i.room_exited.connect(room_exited)
|
||||
|
||||
print("Doors: " + str(doors))
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
@@ -53,5 +58,18 @@ func _process(delta):
|
||||
i.last_enemy = true
|
||||
|
||||
func last_enemy_dead():
|
||||
if room_lockdown:
|
||||
room_lockdown = false
|
||||
|
||||
for i in doors:
|
||||
i.open()
|
||||
if !i.door_open:
|
||||
i.open()
|
||||
|
||||
func room_entered():
|
||||
if room_lockdown:
|
||||
for i in doors:
|
||||
if i.door_open:
|
||||
i.close()
|
||||
|
||||
func room_exited():
|
||||
print("ELVIS HAS LEFT THE BUILDING")
|
||||
|
||||
Reference in New Issue
Block a user