Godot Version
4.7
I made a portal scene that teleports the player to a new area when stepped on and attached a simple script to it that has some @exportexportexportexportexportexportexportexportexportexportexportexportexportexportexportexport vars to use when teleporting. I then went into my level scene, instantiated the portal scene, and put them where I wanted them, but w@exporten I change their@exportrespe@exportexporttive @export vars they all share the same values from one of the portals and arenât us@exportng their values I@exportassig@exported.
I read that @export would make each node have unique values, but nothing has worked that I have read from other posts. The only option I can think of at this point is I have to add each portal to the level via code and assign their values at that time for them to be unique.
class_name Portals extends Node
@export var isPortalActive: bool
@export var locationPortalIsAt: String
@export var toCords: Vector2
@export var areaComingFrom: String
@export var areaToGoTo: String
signal sendPlayerNewCords
Called when the node enters the scene tree for the first time.
func _ready() â void:
get_owner().get_node(â../../Characterâ).connect(âenteredPortalâ,_portal_entered)
#$â../Characterâ.connect(âenteredBattlePortalâ, _portal_entered)
Called every frame. âdeltaâ is the elapsed time since the previous frame
func _process(_delta: float) â void:
pass
func _portal_entered() â void:
#if locationPortalIsAt == âShikaakwaâ:
if isPortalActive == true:
get_owner().get_node(str(areaComingFrom)).visible = false
get_owner().get_node(str(areaToGoTo)).visible = true
sendPlayerNewCords.emit(toCords)
else:
print(âArea coming soon..â)
