Set Player position depending on which layout came from

0 favourites
  • 4 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I have a Plaformer game that I am working on to help me learn Construct 2 while creating something. Right now I have a preset starting position on layout1 ("Level 1"), but when I leave this level by climbing a ladder above which loads layout2 ("Level 2") I want to be able to then climb down that ladder and it set me to where I left off. I can't figure this out, seems simple but I can't get it from starting me back at the very beginning of Level 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add some Global variables named 'from layoutX_to_layoutA', 'from layoutY_to_layoutA', 'from layoutZ_to_layoutA', etc...

    Anyway, then just add 1 to them when you leave a particular layout, then check for them on the incoming layout with 'on layout start'. Use that to determine where to spawn/move player.

    Don't forget to clear them when you are done.

    Cheers, T

  • If there are many layouts I would probably just create one global var with a unique FromLayoutID for each layout, then process that when you load the new layout

  • Ok I think I understand what you guys are saying, would you recommend creating an invisible checkpoint depending in which way I exit the layout. This in turn changes my global to either 1 or 2..etc then upon re-entering the layout it would know where I came from ie North or East and position me in that location. Then another question if I wanted to make a bonus cloud level or whatever that's in the sky Mario style. Depending where player falls from above could I correlate that to the below layout upon re-entering?

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