How do I make an object disappear when it hits the bottom of the screen. And how do I make new objects randomly fall from the top.
if (getY() > getWorld().getHeight() - getImage().getHeight() / 2) {
getWorld().removeObject(this);
}if (Greenfoot.getRandomNumber(100) < 4) { // percent chance that an actor will be added, now it's a 4 % chance
ActorName actor = new ActorName();
addObject(actor, Greenfoot.getRandomNumber(getWidth()), actor.getImage().getHeight() / 2);
}