Can I Combine Align And Randomize Scenes?

Discussion in 'Level Design' started by Rasha, Jan 19, 2020.

  1. Rasha

    Rasha Boxer

    Joined:
    Jan 3, 2020
    Messages:
    17
    Likes Received:
    1
    I want to start with the first 3 scenes in order then play few scenes in random order then for the last few randomly, so the game could be endless.. is that possible ?
     
  2. Hanomax

    Hanomax Avid Boxer

    Joined:
    Aug 24, 2018
    Messages:
    156
    Likes Received:
    84
    It is possible with script.
    https://buildbox.com/forum/index.php?threads/addscene-example.18079/#post-93574
    In linked thread, you can see code logic. For first 3 scenes, you just use:
    this.scene().addLevel('scene1');
    this.scene().addLevel('scene2');
    this.scene().addLevel('scene3');
    Then you have to generate random number, which values is between those scene numbers you want to be randomized. And add those into addLevel function.
     
    Miko Buildbox likes this.
  3. Rasha

    Rasha Boxer

    Joined:
    Jan 3, 2020
    Messages:
    17
    Likes Received:
    1
    Great .. Thank you
     
  4. Rasha

    Rasha Boxer

    Joined:
    Jan 3, 2020
    Messages:
    17
    Likes Received:
    1

    could you please explain for the random function?... output for Math.round(Math.random() *2)+1 , should be form 1 to 10 but I want to understand the function, so I can use it for deferent outputs
     
  5. Rasha

    Rasha Boxer

    Joined:
    Jan 3, 2020
    Messages:
    17
    Likes Received:
    1
    I found what I need .. Thanks
     
    Hanomax likes this.
  6. Redouane

    Redouane Boxer

    Joined:
    Nov 18, 2018
    Messages:
    12
    Likes Received:
    0
    Hi Hanomax. I am working on a game with an x amount of levels. Every scene is a level with a finish line. Let's say I have 30 scenes all 100 frames. The first five 'easy' ones I want to loop randomly 5 times so between 0 and 2500 frames I only want the first five scenes randomly. Then I want to do the same things with the second and third five. And then with the last fifteen, which are the hardest. I want to loop them infinitly. Do you know how I can put this in script?
     

Share This Page