Push a button, and the scene changes to a random scene

Hi i looking for some help, im trying to make a button, when pressed, changes the scene to random scene ( chooses a scene, i allready made).

Answers

  • NalycanNalycan Member, PRO Posts: 97

    Hi.

    Lets say you have 3 scenes.

    Make a actor, the button.
    Make an attribute inside this actor, call it something like "RandomScene".
    Make a rule, when touch is pressed random attribute "RandomScene" from 1 to 3.
    Make 3 other rules, one for each scene.

    1. If "RandomScene" is "1", change scene to scene 1.
    2. If "RandomScene" is "2", change scene to scene 2.
    3. If "RandomScene" is "3", change scene to scene 3.

    Hope this helps :wink:

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @andreaslolsen

    As @Lycan says.

    But you can also call a scene by its index.
    So assuming scenes 2 to 5 are the ones you want to call randomly,
    then use the Change scene behavior at index = random(2,5)

  • andreaslolsenandreaslolsen Member Posts: 5

    Super did not see that you could change scene by index. Thx

Sign In or Register to comment.