the coding for:if an object is at world edge add new object from the current object location --e.g object is a "ball"
if(isAtEdge) {
getWorld().addObject(ball,getX(),getY());
}
int i = 1; // Declare this variable
Public void act
{
SpawnBall();
}
Public class SpawnBall()
{
if ( i<=5 && isAtEdge())
{
World world=getWorld();
world.addObject( new Ball(), (//put x here//),(//put y here//));
i++;
}
}