Asteroids Random Sprites

L

Lorddoug

Guest
Hello, NooB needs some advice. Doing the Asteroids tutorial Drag and Drop mode. I am not at home so can't post the code, but maybe you can help anyway?

As per the tutorial I use Random function to assign three different sprite sizes to Obj_Asteroid. The Sprite options are:
1. Spr_Asteroid_Sm, 2. Spr_Asteroid_Med, 3. Spr_Asteroid_Big.

Each Sprite appears to be just as per tutorial. However when I run the game I only get _Sm and _Med asteroids. So I run it again (it is random afterall) Same result next 5 times I run.

I changed the Option order to 1. _Sm, 2. _Big, 3. _Med. ...Now I only get _Sm and _Big, but no _Med asteroids???

So I added an option 4. _Med. Now I get all three sizes, but only one _Sm each time I run.

This is not very random! Any clues as to what is wrong here? Thx.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Take a look at the randomize function in the manual. Call it once at the start of the game and the results will actually be random.

The random number generator uses a fixed seed by default to assist with debugging (as debugging random results is much harder than working with the same "random" results every time). This can be overridden via the aforementioned function.
 
L

Lorddoug

Guest
Ok I will look into that...Funny thing is the tutorial video, I noticed since I posted this, had the same problem as me. She says "As you can see we now have all three sizes of asteroids" but there are only two sizes. Then in next video this is mysteriously fixed. I sort of fixed my problem just by adding a few more instances. Thanks.
 
Last edited by a moderator:
Top