Ok I am going to do it a different way.
What I would like is a shroom that spawns on certain random x coord.
I would like it to spawn levelwide, but not say between, x coords 50-100 AND NOT between xcoord 500-600.
How would I go by that?
int x = getRandomNumber(getWidth()-150); if (x > 50) x += 50; if (x > 500) x += 100;
public void add(int addAmt)
{
ScoreCounter+=addAmt;
updateImage();
int x = (Greenfoot.getRandomNumber(getWorld().getWidth()-(1200-1088)-(352-282)-(896-640)));
if (x > 1088) x += 112;
if (x > 282) x += 70;
if (x > 640) x += 256;
int y = Greenfoot.getRandomNumber(51)+300;
if(ScoreCounter == 1)
{
getWorld().addObject(new Shroom(), x, y);
}
if(ScoreCounter == 2)
{
getWorld().addObject(new Shroom(), x, y);
} int x = (Greenfoot.getRandomNumber(getWorld().getWidth()-(352-282)-(896-640)-(1200-1088)));
if (x > 282) x += 70;
if (x > 640) x += 256;
if (x > 1088) x += 112;