How do I go to a random layout

0 favourites
  • 6 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • hello all

    example:

    in my game i want to prepare like 10 easy level, 10 middle, 10 hard

    when the game start you spawn in a random easy level, who gets you to a random middle who get you to a random hard.

    so there is replayability.

    but i dont know how to do that . in the events, i cant enter an expression, it must go to a specific layout.

    thanks !

  • You go to layout by name (Text). So just construct your layout names based on some numbering scheme, and construct the layout name Text in your Go to action based on your randomly chosen number or other expression.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    name your layouts, for example: level0 level1, level2 etc.

    Create a random number when wanting to go to your random layout, Then use:

    System: gotolayout(byname) > 'level' & randomnumber.

    happy constructing.

  • Haha, codah replied while I was replying...

  • Im sure there is a better way, but i know this way works at least.

    https://www.dropbox.com/s/jkp0akef7mg5n ... ycler.capx

    Create a global variable and name it something like Random_Gen

    This will be a number you will be setting to a random whole number within a range (I.e 10)

    In the example I use "Spacebar" to generate a random whole number between 1-3 using the "Choose" expression

    I then have a global variable which handles increasing the difficulty which in reality is just pushing the event check down a notch into a different set of layouts to pick from.

    so you have 1-3 easy, 4-6 medium and 7-9 Hard

    I used 9 levels just to get the point across, but you can set the "choose" expression to something like this "Choose(1,2,3,4,5,6,7,8,9,10)" (no quotes or you will get a string)

    I hope this helps!

    Austin Morgan

    Varia Games

  • great !! thats exactly what i needed! thanks a lot !

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