Crazy Random!

0 favourites
  • 5 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello guys, I'm experiencing a problem with the random. I have a variable of Points. Every 1 point I want to randomize another variable called candyRandomizer.

    The random works, but once point reach 1 the random number won't pick a new number and stop, instead, it keeps changing the number to a random number every tick :( I just want to change the number once the point is reached, not to keep changing in an eternal loop. :(


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can add that code to the place where you increase unicornPoints, that way the code only runs when the point gets added.

    the other option is to use another variable as a flag. When you increase unicornPoints, set the flag to 1.

    then change your code to say:

    System flag = 1 -> then set candyRandomizer to random(4), and flag = 0

    then the code wont run again until flag is 1 again.

  • You can add "trigger once while true" to your current condition, also.

  • trigger once was my first idea too, so I tried it, and it doesn't reset until the unicornPoints variable goes down to a value below what triggers the condition. There wasn't enough code shown to know if that ever happens, so I didn't mention it...

    I thought that maybe just changing the variable to a new value would reset it, but it didn't.

  • Hello guys, well what I'm trying to achieve is to change that CandyRandomizer to another random number every time the unicornPoints increases +10, every 10 new points added to the unicornPoints.

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