T
TheRBZ
Guest
I've made an obj_tree which can choose a variation out of 4 different sprites (so the object doesn't look repeated) but when I try my code, all trees are the same type.
I can confirm that this is not an issue with the sprite_index applying to all instances* because every time I run the game they are of a variation '0'.
Why is my irandom(3) function always outputting 0?
Yes, the sprites it can choose from are different.
*instances are put in the room manually, only for testing so using the create event per instance won't cut it
I can confirm that this is not an issue with the sprite_index applying to all instances* because every time I run the game they are of a variation '0'.
Why is my irandom(3) function always outputting 0?
Yes, the sprites it can choose from are different.
*instances are put in the room manually, only for testing so using the create event per instance won't cut it
Code:
randomize();
image_xscale = 2;
image_yscale = 2;
var type = 1;
var variation = irandom(3);
sprite_index = "sprite_tree_big_type"+string(type)+"_"+string(variation);