Issue with Teleporting Between layouts.

0 favourites
  • 3 posts
  • Currently, I have a system that allows me to easily create loading zones at the ends of the screen in a 2D game, however when using a duplicate of that system to create doors within the screen, the player will enter the layout from the exit defined by the first system.

    When entering from 2, the player should appear in the second layout at point 4, however they end up at point 3 when first entering the room through either point 1 or 2.

    After using the door and entering from point 1, the player is put at point 4 again when they should enter from point 3.

  • You can use one object for the spawn locations and make it invisible so use a sprite for this then it should be one function for all teleports in the game as you were attempting to use. Send layout to go to and targeted ID to use for set position of the player as parameters in one function.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's an example project with the basics -

    The key components of doors and portals are:

    1. Where are you going - Usually stored as an instance variable in the door. This is used to change to the correct layout.

    2. Where did you come from - Can be stored in a global variable or an instance variable in the player object. This is used for positioning upon entering a layout

    Optional - A second instance variable identifying door pairs if you have multiple doors that go between the same layouts.

    3. Active state - A triggered state so you don't "bounce" back and forth between doors. You can use a timer like you had (not recommended), user input (what I had in the example), or offset the destination/spawn location per lionz suggestion.

    I use a single object for all doors, considering they are all functionally the same. If you want to have multiple objects for doors, then put them all in the same family and use the family object for your event sheet logic to keep it just as clean.

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