• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Is random random?

G

GolemRO

Guest
Hello!
Right now, I am working on a little "Whack-a-Mole" style game and I use the random(value) function to make the Moles appear, well, randomly.
for example...
[step event]
...
if(status==0)
{
...
//some code
if(floor(random(300))==100)//something random
status=1 //status 1 will make the mole appear and do other stuff.
}
else if(status==1)
{
...
//mole appears, after 1 seccond or hit by hammer status become 0, and so on.
}
...

In the main room are 9 Mole objects(placed like a 3x3 grid), every one executing individually that part of the code. After running the game several times, I found out that the Moles appear in some sort of pattern, fact that bothers me and make the game easier...

Is there a soluion for this problem?
,':\
 

SeraphSword

Member
To clarify FrostyCat's comment, make sure to use the randomize() in an object that spawns at the very start of your game. This is only necessary in the development stages, when you export your project random should work fine without it. Random always generates the same seed in development to help with debugging.
 
Top