How do I generate random noise at runtime?

0 favourites
  • 4 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hi, probably a silly question but i can not for the life in me get the advanced random plugin to re-generate at runtime.

    I want to randomly create objects as obstacles using noise from the advanced random plugin. When i run the game initially it will generate and spawn the objects correctly but once the level is finished and i want to restart the layout it does not generate a new noise.

    I have tried using a keypress function to re-generate but again can not seem to get it working correctly.

    Have also looked over the documentation for the plugin but i dont think i understand its usage correctly.

    Any help in pointing me in the right direction would be fantastic.

    attached an image and a c3p file to help.

    dropbox.com/s/2bb5g5r48ikonit/randomProblem.c3p

  • You have to re-seed the plugin if you want to generate a new set of noise values.

    The easiest way is to update the seed with AdvancedRandom.RandomSeed on each call to GenerateWalls.

  • That worked! thanks so much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As a side note, since you are destroying most "walls" sprites as soon as they are created, creating them conditionally instead would speed up things tremendously.

    Also, you create ViewportWidth * ViewportPortHeight + 10 objects, and yet you place them quite beyond the limit of the viewport, I'm not sure if this is intended. Are you trying to tentatively create an object every 10 pixels inside the viewport ?

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