How Do I Go To Next/Previous Layout ?

0 favourites
  • 8 posts
  • 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?

  • 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)

  • Thanks, I'll give it a shot. :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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??

  • 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 ...

  • I can catch it yet, can u please provide a simple capx?

  • 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...

  • NotionGames:

    I don't get it yet, can u please provide the .capx file??

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