Teleports

0 favourites
  • 9 posts
  • Hi, pls how to made tekeports in grid base game?

    I have object teleport1 and teleport2 and when player is collison with teleport 1 -> set player position to teleport 2. And when player is collision with teleport2 -> set player position to teleport1 . I tryed to control with variable, but id does not work....

    pls helpe me

    thx for replies

  • It sounds like the events are running a loop, since reappearing at the destination triggers the collision event, sending the player back to the first teleporter, and on and on it goes...

    I'd suggest adding a short timer to the player to prevent this from happening: reset the timer whenever the player teleports, and only activate the teleporters if the timer has elapsed a few seconds.

  • Add sprites around your teleport. If the player touches the sprite the teleport will be active again. If the player uses the teleport it will be disabled until he touches the sprite around the teleport. This will stop your loop.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes i tryed it, but no effect, because i need after teleportation that teleport active only when i go away and i return again.... not after few seconds...

  • use the overlapping function(inverted) and keep the teleporter disabled until the sprite is not overlapping the object by having a global variable so that on the colision of a teleporter add 1 to the variable and keep the teleporter disabled until the variable > 2 and set the variable to 0 when the sprite is no longer overlapping the teleporter.

    sprite on collision with teleporter

    -variable=variable+1

    if variable >2

    -teleport disabled

    if sprite overlapping(x) teleporter

    -variable=0

  • I would take it a step further and put an instance variable on the teleport - for cases where more than one is desired. For that matter, I would even put an instance variable on the player called "teleporting" and set it to 1 when teleported. When a teleport detects collision with a player that is flagged as "in teleport", it sets its own instance variable to 1, resets the player's, then waits for the player to move off to reset itself (as mentioned above).

  • that would make it easier for people who do not have object families

  • Thx i made little error in my code.... -,- Now it is OK :P

  • Might make a tutorial

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)