Object Is Getting Spawned On Another Scene

Discussion in 'How Can I...?' started by Zhubi, Mar 13, 2020.

  1. Zhubi

    Zhubi Boxer

    Joined:
    Mar 2, 2020
    Messages:
    16
    Likes Received:
    0
    Hello, I've built an object spawner and when I play it spawns the objects on different scenes, not where it is supposed to.. but I think I know where's the problem:
    I've added a Script that starts the first rounds as 1, 2 and 3 and then randomizes the scenes, the script is :
    function signal(name, value){
    this.scene().addLevel('1');
    this.scene().addLevel('2');
    this.scene().addLevel('3');
    this.scene().addLevel(String(Math.round(Math.random() *10)+3));
    this.scene().addLevel(String(Math.round(Math.random() *10)+3));
    etc.. ( it has more similar lines), and the object spawner script has this code inside:

    "let index = Math.round(Math.random() * _assets.length);"
    I think this code "Math.round(Math.random()" has something to do with this..
    I don't have much knowledge in programming and I need some help, someone who know how to fix this would be very helpful !
     
  2. Zhubi

    Zhubi Boxer

    Joined:
    Mar 2, 2020
    Messages:
    16
    Likes Received:
    0
    When I play the game from first round it happens as I said, but when I play only the selected scene it goes well..
     

Share This Page