I know math.random is a good thing to use here, but I have no clue how to do it.
I’m creating a small basic fish tank for a friends little girl, and I have the fish, but want to generate 5 random fishes and randomly place the fish in the tank, while also giving the fishes random sizes. Anyone know how I could do that?
here is my code:
for(var i:uint = 0; i<5; i++)
{
var schoolOfFishes:YellowFish = new YellowFish();
this.addChild(schoolOfFishes);
schoolOfFishes.x = 20 * i;
schoolOfFishes.y = 20 * i;
schoolOfFishes.width = 30;
schoolOfFishes.height = 30;
schoolOfFishes.rotation = 180;
schoolOfFishes.scaleX *= -1;
schoolOfFishes.scaleY *= -1;
}
I managed to get 5 fishes, but it isn’t how I wanted it. It should be random in the tank