teleportation?

Tales

Member
Hello!

I need to "teleport" a objetc. BUT :

-without destroy/recreate it
-without use x=xxx because there is other objects between 2 points and it dont works
-without changing room and rechanging room

I tried things like "action_set_relative(1) action_move_to, move toward point" but dont works because of all others object in the trajectory (and "action" seems deprecated) ..

I dont know all function in GM, I search but if there is someting..

(maybe its not possible to "teleport" item?)
 

samspade

Member
In general, you set an instance's position by setting its x and y value. It can be more complex but something as simple as:

Code:
if (condition) {
    x = new_x;
    y = new_y; 
}
would work. If you're not using x and y for position, you'd set whatever you were using instead.
 

Tales

Member
it dont works, it seems the object GO to the position, but there is things on the trajectory, so it dont works. Its not a "teleportation" :s
 

samspade

Member
Are you using physics?

Otherwise, setting an instance's position is completely unconnected to a trajectory. I do it all the time and the above does work. Make sure to post the code you do have and have tried.
 

Tales

Member
no i dont use physics!

Exactly the same code, instead of x=xxx; y=xxx, i do

room goto (teleport room);

and when in teleport room

room goto (the room I need)
x=xxx; y=xxx

and this works.. But I dont want to have a room only to "teleport"..

EDIT : it seems there is really something interfering because I move all object between the 2 position, the character dont move at all.. I dont know why "x=xxx:y=yyy" dont work...........

thanks for responding I guess I keep teleport solution..
 
Last edited:

samspade

Member
If you setting the x and y variables directly and going there then you would have something interfering.
 
Top