B
BlooRooster1
Guest
Hello, I have a simple system that I absolutely cannot get to work properly.
I have a two "teleporters" within the same room that I want to transfer the player back and forth between. Entering tele A transfers to tele B, entering tele B transfers to tele A.
I have renamed two instances of "obj_tele" in the room editor as "tele1" and "tele2" and in the room editor instance creation code, I have:
tele1:
tele2:
And in the Step Event for the "obj_tele" i have:
Strangely, it works correctly from Tele 1 to Tele 2, but it does not go from Tele 2 back to Tele 1.
Checking the debug, shows that each instance is setting the correct 'targetx' and 'targety'.
Any idea what is happening here? Thanks in advance!
I have a two "teleporters" within the same room that I want to transfer the player back and forth between. Entering tele A transfers to tele B, entering tele B transfers to tele A.
I have renamed two instances of "obj_tele" in the room editor as "tele1" and "tele2" and in the room editor instance creation code, I have:
tele1:
Code:
targetx = tele2.x;
targety = tele2.y;
Code:
targetx = tele1.x;
targety = tele1.y;
And in the Step Event for the "obj_tele" i have:
Code:
if obj_player.state == "move" {
if (instance_place(x,y,obj_player)) {
if (obj_player.key_select) {
obj_player.x = targetx;
obj_player.y = targety;
}
}
}
Checking the debug, shows that each instance is setting the correct 'targetx' and 'targety'.
Any idea what is happening here? Thanks in advance!