Go to random layout.

This forum is currently in read-only mode.
0 favourites
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
  • I want to go to a random layout when a level ends. Random within a select group of layouts, so as not to go to the menu or whatever.

    I thought about spawning a random invisible tile at the levels exit that corresponds to a unique layout, but this doesnt seem to be the most practical way to achieve this.

    Any of you out there have a better, easier way?

  • Nevermind, figured it out by thinking a little more, now i feel dumb.

  • Thats cool. Can you tell me how you did it ?

  • "Go to layout" and then "random(n) + a" where n is the number of layouts to select from after starting point a.

    For more direct layout selection you can use an array like R0j0hound did for sprite spawning like so:

    {"man", "woman", "monster", "kid"}@(random(4)+1)

  • Ill try that out Jayjay, thanks for the tip.

    I found another way, not sure if its the best way, but it worked for me.

    At the start of the layout I generate a random number within say 1 and 100, and store it in a global variable.

    I set this number at the layout start because I use it to randomize other stuff too.

    At the end of the layout, if my number is between 1 and 10, go to layout 1. If its between 11 and 30, go to layout 2, between 31 and 100 go to layout 3, etc.

    Don�t know how practical this is, but it does the job and it also lets me decide how often a layout should appear by playing around with the ranges.

    In this example layout 2 would be used less than layout 3, but more than 1 because of the chances my number has to land on each range.

  • where exactl have I add the "Go to layout" and then "random(n) + a" ?

  • Its actually System-> Go to layout (by name) then type random in the text box.

  • So me and some classmates are making a quiz for a client. We have come up with alot of questions and divided them into categories. The client wants them to be randomized. My question is, how do you randomize the questions within one category? Thanks in advance.

  • farrellsupreme, well if you keep the questions in order (eg: questions 1 to 4 are category 1, 5 to 8 are 2, 9 to 15 are 3, etc).

    You can do it this way:

    global('QuestionNum') = floor(random(global('CategoryQuestions')) + global('CategoryFirstQuestion'))

    So that could be this code for category 1:

    QuestionNum = floor(random(4) + 1 )

    Random always goes just up to the number inside so in this case it would be rounded (floored) to 3, then add the +1 for making the category range of 1 to 4

  • We tried it but it didn't work. Can i send the file to someone? I have one with 12 questions and one with 14 questions.. I'm wondering if one of you can randomize it??

  • Sure, PM me a link to it (host on dropbox), and I'll see if I can take a look for you.

  • "Go to layout" and then "random(n) + a" where n is the number of layouts to select from after starting point a.

    For more direct layout selection you can use an array like R0j0hound did for sprite spawning like so:

    {"man", "woman", "monster", "kid"}@(random(4)+1)

    Can you please help:

    I have 4 layouts. and i want the first layout to link to the other 3 layouts randomly. the name of the layouts are:

    Layout 1 (which contains the link button)

    Layout 2

    Layout 3

    Layout 4

    You just said Go to layout" and then "random(n) + a" where n is the number of layouts to select from after starting point a." How should the code be for me than?

  • Sure, PM me a link to it (host on dropbox), and I'll see if I can take a look for you.

  • > Sure, PM me a link to it (host on dropbox), and I'll see if I can take a look for you.

    >

    Okay i can't PM because of my reputation points. But here is the link

  • Try Construct 3

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

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

    > > Sure, PM me a link to it (host on dropbox), and I'll see if I can take a look for you.

    > >

    >

    Here you are

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