29 lines
712 B
GDScript
29 lines
712 B
GDScript
extends Node2D
|
|
|
|
@export var paired_teleporter: String
|
|
var checked_teleport
|
|
|
|
func _ready() -> void:
|
|
add_to_group("TELEPORTERS")
|
|
|
|
func check_for_pair() -> String:
|
|
print(paired_teleporter)
|
|
return paired_teleporter
|
|
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
pass
|
|
|
|
func _on_contact(body) -> void:
|
|
#print("PASSED OVER TELEPORTER")
|
|
#get_tree().call_group("TELEPORTERS","check_for_pair")
|
|
for teleporter in get_tree().get_nodes_in_group("TELEPORTERS"):
|
|
print("PAIRED" + str(teleporter))
|
|
print("SELF" + str(self))
|
|
if teleporter != self:
|
|
if %Player2D.teleport_cooldown == 0:
|
|
body.set_position(teleporter.get_position())
|
|
%Player2D.teleport_cooldown = 1
|