Set Player position depending on which layout came from

Get help using Construct 2

Post » Thu Feb 20, 2014 4:19 am

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.
B
4
Posts: 4
Reputation: 213

Post » Thu Feb 20, 2014 5:12 am

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
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Thu Feb 20, 2014 6:36 am

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
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Sat Feb 22, 2014 7:54 pm

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?
B
4
Posts: 4
Reputation: 213


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests