Limited Space
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
ld54/nodes/triggers/level_trigger.gd

27 lines
652 B

extends Area2D
@export var KILL_ALL_NPCS = false
@export var LEVEL_MESSAGE : String = ''
@export var ENABLED_NODES : Array[Node] = []
@export var DISABLED_NODES : Array[Node] = []
@export var UI : Node
# Called when the node enters the scene tree for the first time.
func _ready():
body_entered.connect(on_body_entered)
func on_body_entered(body):
if !body.is_in_group('player'):
return
if KILL_ALL_NPCS:
if body.is_in_group("npc"):
body.queue_free()
if LEVEL_MESSAGE:
if UI:
UI.show_message(LEVEL_MESSAGE)
for node in ENABLED_NODES:
node.set_physics_process(true)
for node in DISABLED_NODES:
node.set_physics_process(false)