How to make a teleporter [SOLVED]

I have the needed functions for a game in Gdevelop (Camera centered on player, and restart function) but except I wanna add another feature to my game where there is teleportation involved. I can easily make a portal with piskel so I’m wondering if you could show me how to make a portal work after you have made it. I’m pretty new to Gdevelop (Been using it for a few days) so it would be better if you gave me an image because I’m not too great when it’s explained with text. Thanks!

Add two instance variables to your portal object:
id - a unique id
destination - the id of the portal you want this portal to warp to

Add a scene variable “WarpDestination”

Add a condition:
If Player in collision with Portal → WarpDestination = Portal.destination

Add another condition:
If WarpDestination != 0 == WarpDestination
Set WarpDestination to 0
Move player to portal.x, portal.y

I’m stuck at the, “Add a condition” part. Can I have an image of what to do (just for that part)?

Just do, if player is in collision with portal, use the “position” action to change player X and Y to the coordinates that you want (Or use a variable if you want to be able to change it through code). If you want to teleport to an object then just use the “Put object around another” and use a distance and angle of 0.

this is what I have done so far. have i already messed up?

Actually, I added a bit more and it worked!! Thanks!!

No problem, happy to help : )

1 Like