E
Elian
Guest
I need that when a key is pressed on the keyboard(Esc), the player teleports to the desired object...
Help please, I don't know what code to use for this(
Help please, I don't know what code to use for this(
what about create event of target?On your keypress code
Player.x = Target.x;
Player.y = Target.y;
Target can be another objects x,y
or just use a hard coded number
Player.x = 450;
What about it? You haven't said that anything else should happen. Tyg's code will work perfectly (for just teleporting).what about create event of target?
The problem is nothing happens:What about it? You haven't said that anything else should happen. Tyg's code will work perfectly (for just teleporting).
Obj_player.x = Obj_shield.x;
Obj_player.y = Obj_shield.y;
Yes, the object exists in the worldmaybe your object doesnt exist
you should put
if object exists
where are you puting the code?
If you placed it in the obj_player's Key Down (ESC) event, then you can just code it;Yes, the object exists in the world
Code... obj_player -> key down escape (event) ->
Obj_player.x = Obj_shield.x;
Obj_player.y = Obj_shield.y;
x = obj_shield.x;
y = obj_shield.y;
if instance_exists(obj_shield) {
x = obj_shield.x;
y = obj_shield.y;
}