This commit is contained in:
Marek Lenczewski
2026-04-04 00:00:15 +02:00
parent 3488856b91
commit f1d34ebf1d
104 changed files with 1912 additions and 1789 deletions

21
systems/portal_system.gd Normal file
View File

@@ -0,0 +1,21 @@
extends Node
const GATE_SCENE: PackedScene = preload("res://scenes/portal/gate.tscn")
func _ready() -> void:
EventBus.entity_died.connect(_on_entity_died)
func _on_entity_died(entity: Node) -> void:
if not entity.is_in_group("portals"):
return
if not entity.is_inside_tree():
return
var pos: Vector3 = entity.global_position
var gate: Node3D = GATE_SCENE.instantiate()
entity.get_parent().add_child(gate)
gate.global_position = pos
for enemy in get_tree().get_nodes_in_group("enemies"):
if is_instance_valid(enemy):
enemy.queue_free()
EventBus.portal_defeated.emit(entity)
entity.queue_free()