How do I make a teleporter in a platforming game?

I want to make it so that the player does some platforming and touches the portal to progress ahead in the level
game link

1 Like

You could possibly just have 2 portals, the first is the one that triggers the second one. When the player hits the first one it extracts the other portal’s position and goes there.

2 Likes

I get stuck when I use it but otherwise it works

1 Like

Check collisions?

1 Like

It’s still not working can you please help? The portals are in level 2.

1 Like

Alright so, for extractors you have to select the object, which only works for one level since when you clone a type is adds a new object each time. Also, the portals HAVE to be in your level, if they aren’t they are no longer and object and you can’t extract from them. A super good way to do things like this is to use the portal object to set a global. You can name the globals whatever you want, but all you need is 4. I’d recommend “portal x” and “portal y”, then for the 2nd 2 just add “2” to the end. You can extract the portal positions and set the globals, then just have it so when the player collides with one it gets the global value. This will let it work in between levels and with multiple objects.

1 Like

Portal 1 code:

portal 2 code:

Portal properties (both!):
Player code:

2 Likes

How do I do the player code that’s a lot and I don’t know the time on the timers

1 Like

It’s one second, and you just connect the lines how I did-

Also it’s not a lot of code and can be done in 5-10 minutes if you took the time to actually get it done lol

I did it on mobile last night in about 1 or 2 minutes so god I hope you can get it done it 10 :joy:

2 Likes

21 behaviors needed

2 Likes

If you think that’s a lot of code, do not go into the edit menu on my games…

3 Likes

…I’ve done that…

3 Likes


Did I do it right?

1 Like

You forgot one little piece…

Also, off topic, but if you like complicated spaghetti… I made this guy this morning…

3 Likes

I added the missing piece but it still takes me to the location of the second portal and leaves me unable to move.
@00T_Free

3 Likes

Hmmm… better ask Dino about that. You might need to link your game to him so he can investigate. I haven’t played around with teleporters yet.

3 Likes

Damn, everytime I check this post I’m on mobile. It’s hard to help on mobile, sorry. I’ll just give tips again.

Check colliders, make sure the object is NOT solid but collisions ARE on.

2 Likes

Keep up the great work, I hope that code paid off! Time is dang valuable nowadays.

2 Likes

That is what I did.

1 Like

Since I have similar (but not identical) code on several other objects already, it’s gotten easy for me to add a new sprite. I have a set order that I do everything in. Add the sprite, add animations (usually at least 1 moving and 1 dying animation), set movements, set collisions with weapons, set collisions with targets, set sprite health, send messages upon sprite death, set weapons to either detonate when colliding with sprite or allow them to pass through sprite, set sprite’s targets to take damage when colliding with sprite, set randoms and timers for variable behaviors, set rarity of collectible items to drop upon sprite’s death, set randoms and timers for spawn rates, set sounds and animations to trigger at the right times, etc. Adjust timers, damage amounts, points, random variables etc. as necessary to keep the enemies “balanced”.

Sounds like a lot of work (and I suppose it is), but the more times I do it, the easier it gets to remember what I’m doing. And even the coding is becoming kind of fun to me, like completing a mini 100 piece puzzle.

3 Likes