Random Scene Selection

BluSpyderBluSpyder Member Posts: 129
edited November -1 in Working with GS (Mac)
In my game, i want to have it randomly order which of the scenes(minigames) it runs.

Like when they hit "Play", it goes to another scene, and displays the order in which they will play the minigames. When they hit continue it runs in the scenes in that order. In addition, each minigame has a little score scene between them summing up their total scores.

So how do i go about doing this?


  • mzxmzx Member Posts: 151
    make an integer attribute called: "Scene". Then INSIDE the "press play" , you do the rule:

    -If actor receives touch
    -CHANGE Attribute "Game.Scene" to random(min,max)
    //* your minimum is likely to be "1" and the max stands for the playable levels//*

    Then a NEW Rule:
    -If Attribute "Game.Scene" = 1
    - Change Scene to "Level 1"

    A New RULE:
    -If Attribute "Game.Scene" = 2
    - Change Scene to "Level 2"

    and so on.... :)
  • BluSpyderBluSpyder Member Posts: 129
    Thanks, but that doesn't work with the others. I have 4 minigames. And i want them all randomized so that the user can see what the order will be before they begin. And setting the first scene to randomize between 1-4 already works obviously, but then I need the last 3 to randomize without reselected the ones chosen before them. If that makes sense haha.

    I think what I'm getting at is, I know how to randomize them all by integers, which i have set up. And then call the integers by saying like -If random_game1 = 2 then change scene to game1-

    But how can I have the last 3 minigames be randomized between 1-4 without selecting one that has been selected.

    EX: -random_game1 = (random(1,4))-....and say it comes out to pick 2..then I have...-random_game2 (rand(1,4)-...but i don't want this one to pick 2 as well. And so on.

    Sorry if thats confusing haha...
  • MekonbekonMekonbekon Member Posts: 8
    A hacky way to do it would be:

    Create a boolean attribute for each scene you're choosing from.
    Do your random select to pick a scene.
    When a scene is selected set the boolean for that scene to true.
    Each time you randomly select run a check to see if the boolean for that scene is already true (i.e. has already been picked);
    If it is then discard that result and roll again.
    That way you should only get each scene picked once.

    Hope that makes sense! :)
Sign In or Register to comment.