• 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 Random but not random

S

Steve Potts

Guest
Hi folks, start of create event I run this code :
x = 500 ;
y = 500 ;
direction = irandom_range(0,359);
speed = 4 ;
ballcolour = irandom_range(1,4)-1 ;

The ball always moves in same direction and is always the same colour at start.
I use direction = irandom_range(0,359) ; later in another create for an object and it moves in any random direction.

Why does it work later but the 1st does not ?
Cheers.
 
D

dannyjenn

Guest
Just a guess, but have you used randomize()? You need to call randomize() at game start. If you don't call randomize() then your irandom_range() will use the same seed every time you run the game.
 
Top