Hi everybody,
I'm pretty new in Greenfoot and have a little problem.
I want to randomly create objects in the world. To do this, I used this code in the World class:
The Act-method used then this code:
Now I need a code that would let the objects spawn not over the whole world, but only over a smaller range, i.e. between x=100 and x=500, or from x=100 to the right edge.
public void randomSpawn() { addObject (new Object(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight())); }
public void act() { randomSpawn(); }