I am currently working on a project that requires you to switch "dimensions"(Nodes) The switching part works already. My current code doesn't work at all. I am just going to show what doesn't work. I am using 2 global variables.One is called pos (This should store the position) and the other force_active. This exists because one part of the code checks if it is one all the time. This is in the first node:
(The If-Code belongs to the first KinematicBody2D in the first node, the receiver belongs to the one in the other node.
Global.force_active = 1
Global.pos = position
In the other Node I put the "receiver"
func _reveiver ():
if Global.force_active == 1:
Global.force_active = 0
position = Vector2(Global.pos)
(The code exists in both nodes, the only difference is that the code in my FirstNode checks for force_active == 2 instead of 1)
I want the player to be able to switch dimensions and still end up at the same place as he was in the other dimension. I wrote the code nearly completely by myself since nobody really asked the same question. Since I am very bad at using GDScript this means that this code is also really bad. I pasted it into this question still since I want to learn this language and I really hope that somebody could just add one sentence to the answer that explains why the code is completely wrong.
Thank you for reading till the end of this post.