Need help with Moving back and forth from layouts.

Get help using Construct 2

Post » Wed Sep 19, 2012 12:56 pm

I'm making a 2d sidescroller game that requires a player to move from one layout to the other, and occasionally back to the previous layout after hitting a trigger. For example. Player starts in Layout 1-3-1, and moves into layout 1-3-1a, activates a painting which opens up a hidden wall in 1-3-2.

How do I make it so the player exits 1-3-1a and spawns in the same point that he entered 1-3-1a, instead of at the initial spawn on 1-3-1?
B
3
Posts: 4
Reputation: 383

Post » Wed Sep 19, 2012 2:38 pm

Hey Jordan,

Here is a simple way to do it: If you give your player an instance variable called "Location", you could then update it as your player moves between layouts.

So when you leave a layout, you could also set the variable to 1.3.1.1 for example. Now you can add an "On start of layout" event like :

On Start of layout
Player Location = 1.3.1.1        -> Set player position to desired X and Y.GenkiGenga2012-09-19 14:40:08
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Wed Sep 19, 2012 3:40 pm

Thanks! That's exactly what I'm looking for in an explanation. I'll try that out. Thank you!
B
3
Posts: 4
Reputation: 383

Post » Wed Sep 19, 2012 4:36 pm

Here's one way to do it with different layout widths:

LayoutTransitioning.capx (r103.2)

Hope it helps!
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 25 guests