How do I switch layouts and set player position?

0 favourites
  • 4 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Current have 2 Layouts. I have a "trigger" setup when my player collides that it will switch the layout and set the position of my player. The issue i'm having is that when i try to go back to my first room, it's placing my player at the beginning instead of the position i'm specifying. Can anyone help provide some insight on what i'm trying to do or recommend a tutorial?

    [attachment=0:2p21ep0a][/attachment:2p21ep0a]

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Construct will never run the "set position to" event because it goes to the new layout first. Even if you put the event before going to the new layout it still won't work because it will move your position in the current layout.

    You'd have to set the position using the new layout's event sheet using "start of layout" events. It might also be better to store the position you want to start at as "global" variables especially if moving back and forth between layouts, so for example when you collide with your trigger:

    Set global variable startxpos=1066

    Set global variable startypos=603

    Go to layout "Room 2"

    And in "Room 2" event sheet something like:

    Start Of Layout

    Set position to startxpos & startypos.

    Obviously it's pseudo code and not the exact events but you get the idea.

  • Construct will never run the "set position to" event because it goes to the new layout first. Even if you put the event before going to the new layout it still won't work because it will move your position in the current layout.

    You'd have to set the position using the new layout's event sheet using "start of layout" events. It might also be better to store the position you want to start at as "global" variables especially if moving back and forth between layouts, so for example when you collide with your trigger:

    Set global variable startxpos=1066

    Set global variable startypos=603

    Go to layout "Room 2"

    And in "Room 2" event sheet something like:

    Start Of Layout

    Set position to startxpos & startypos.

    Obviously it's pseudo code and not the exact events but you get the idea.

    Thanks for the help. Global variables are my new best friend

  • How do you do if you only have one event sheet for both layouts ? W_w

    EDIT : sorry for the bump, I found my anwers !

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