Is there a way to randomly add an object that never spawns where the actor you control is?
public void addedToWorld(World world) { Player player=(Player) world.getObjects(Player.class).get(0); int offsetX=Greenfoot.getRandomNumber(world.getWidth()-100); int offsetY=Greenfoot.getRandomNumber(world.getHeight()-100); int spawnX=(player.getX()+50+offsetX)%world.getWidth(); int spawnY=(player.getY()+50+offsetY)%world.getHeight(); setLocation(spawnX,spawnY); }