I want every time objects touch the ground to come down from above
// drop object
setLocation(getX(), getY() + 1);
// ground collision
if (getY() == getWorld().getHeight() - 1)
{
getWorld().removeObject(this);
}
for (int zaehler = 0; zaehler < 10 ; zaehler++)
{
Banane banane = new Banane();
addObject(banane, Greenfoot.getRandomNumber(1080), Greenfoot.getRandomNumber(1));
}
for (int zaehler = 0; zaehler < 5 ; zaehler++)
{Boom boom = new Boom();
addObject(boom,Greenfoot.getRandomNumber(1080), Greenfoot.getRandomNumber(1));
}
I am currently using this code