0 Favourites

How do I Adjust Positioning While Moving Between Levels?

  • I'd like my sprite to move between rooms, or levels.

    How can I make sure it is appearing at the appropriate spot?

    I've added an invisible object and set up my events so that when my player overlaps the object, the system switches to the new level. That's good to go.

    However, when entering the new room from the left, I need the player to appear on the new level on the right side of the screen, and vice versa. Please see my screenshot:

    https://www.dropbox.com/s/qbqr2emvpj61f ... e.png?dl=0

    (I need the player to go from position 1 to position 1, 2 to 2, 3 to 3)

    I have my player sprite set to global so that instance values are retained between levels.

    How should I set up my event sheet so that my sprite is entering each new room properly?

  • You could give an instance-variable to the overlapping objects, on overlap set an instance variable on the player to it and check for that variable on start of the new layout and set the player position accordingly..

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I'm sorry, I don't understand

  • He means you need to have some sort of variable or way to keep track of what the last room/door was. So right before you change layouts, set a variable to either a value of your choosing or the layout name if you don't have multiple doors between two rooms.

    Then, on the start of your layout, check what that location variable is set to and reposition the player based on that. This is an excellent place to use sub events for good organization.

    So On Start-

    If location = a, set position to whatever

    If location = b, set position to a different place

    And so on.

  • Okay, so I've put an instance variable called "PortalFrom" on each invisible overlap object in Level 1_A and numbered them 1-3.

    I've done the same with 3 position markers on Level 1_B and called the instance variable "PortalTo".

    I'm trying to make it so that when the sprite overlaps something with the instance "portalFrom(1)" it is sent to the location of "PortalTo(1)" on the next level.

    It's not working. In the "Set position to" action, there is no place to specify the instance variable number for "PortalTo".

    I'd hate to think that I'll have to create a new sprite for each PortalTo location throughout the whole game!

    It looks like this:

    ----------------------------------------------------------------------------------------------------------------------------

    When Player overlaps object | PortalBricks| Action: Go to next layout|Set position to PositionMarker

    PortalBricks: PortalTo= 0 |

  • Something like this should work:

    Create a variable WhereTo

    When player overlaps object portalbricks

    System set variable whereto to portalbricks.portalto

    goto next layout

    On start of layout

    • Portalbricks compare portalto = Whereto

    > player set position to portalbricks

  • Hmm, it's still not working. I don't know what I'm doing wrong!

  • Seems to me, the on start of layout is meant for the new layout, right?

    Are all layouts using the same event sheet?

    In that case it might be wiser to have a seperate event sheet for each layout and use include event-sheet for all events that are global..

  • I have many event sheets, but they all feed into one main one.

    But, I give up.

    Thanks for your help anyway!

  • I have many event sheets, but they all feed into one main one.

    But, I give up.

    Thanks for your help anyway!

    Don't give up..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
564 105,214
rexrainbow's avatar
rexrainbow
Unread hot topic
99 10,139
karshinkoff's avatar
karshinkoff
Unread hot topic
0 Favourites
Time to move forward?
110 9,561
GG-Works's avatar
GG-Works