How Do I Go To Next/Previous Layout ?

Get help using Construct 2

Post » Thu Oct 31, 2013 10:23 am

I have 2 layout as stages,
Layout 1 as Stage 1
Layout 2 as Stage 2

How do I :
1. make The Character warp to next layout after having collision with the Right Edge of The First Layout?
2. make The Character warp to previous layout after having collision with the Left Edge of The Second Layout?
3. and make it work for the next Layout/Stages?
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Thu Oct 31, 2013 12:43 pm

@Dzaky Alkaff
Make that one on a seperate Eventsheet and include it into any Layout Eventsheet

rEdge = invisible sprite at the right edge
lEdge = invisible sprite at the left edge
Level = global variable
maxLevel = global variable with the number of your levels
+ on collision rEdge
++ Level != maxLevel
--- Level + 1
--- Go to Layout by name("Layout"&level)

+ on collision lEdge
++ Level != 1
--- level - 1
--- Go to Layout by name("Layout"&level)
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Oct 31, 2013 1:00 pm

Thanks, I'll give it a shot. :D
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Thu Oct 31, 2013 2:16 pm

It Works!, but how to set character position near to the rEdge when go to previous stage?.

I've tried to set the position to rEdge.X-100 and rEdge.Y-100, but when I return to the previous stage, the Character position back to the first place(The Left Edge of the Stage) when I start the game.

How do I fix this??
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Thu Oct 31, 2013 2:44 pm

@Dzaky Alkaff

Change the included eventsheet to:

rEdge = invisible sprite at the right edge
lEdge = invisible sprite at the left edge
Level = global variable
LevelBefore = global variable //newline
maxLevel = global variable with the number of your levels
+ on collision rEdge
++ Level != maxLevel
--- LevelBefore = Level //newline
--- Level + 1
--- Go to Layout by name("Layout"&level)

+ on collision lEdge
++ Level != 1
--- LevelBefore = Level //newline
--- level - 1
--- Go to Layout by name("Layout"&level)

+On start of Layout // newline
++ System compare variable: Levelbefore > Level
--- Set Player.X to rEdge.X - 100 ...
++ else
--- Set Player.X to lEdge.X - 100 ...
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Oct 31, 2013 3:29 pm

I can catch it yet, can u please provide a simple capx?
B
11
S
2
G
2
Posts: 62
Reputation: 2,153

Post » Thu Oct 31, 2013 3:53 pm

I just do it like this:

ON player collision with invisible sprite
   - Set variable Position to X (whatever value you want which will               change depending on how many positions you can spawn to on your layouts)
   - Go to Layout

On each event sheet have a

On Layout Start
   - If Position = X
        - Set Player position to (X, Y)

and that's it...
   
Image
B
72
S
20
G
9
Posts: 556
Reputation: 13,866

Post » Sun Nov 03, 2013 10:58 am

@NotionGames:
I don't get it yet, can u please provide the .capx file??
B
11
S
2
G
2
Posts: 62
Reputation: 2,153


Return to How do I....?

Who is online

Users browsing this forum: mihirolover, Prominent, tarek2 and 7 guests