this script is for when my ball makes contact with the pointball, the pointball will be removed, then when the ball reaches the outer limits, it removes itself. I just added the second set of script today (beginning at Actor pointball) , and when i play my game, i get an error message when the ball reaches the outer limits... something that didnt happen before i added the new code.
public void act()
{
move(10.0);
{
boolean topEdge = getY() == 0;
boolean leftEdge = getX() == 0;
boolean rightEdge = getX() >= getWorld().getWidth() - 1;
boolean bottomEdge = getY() >= getWorld().getHeight() - 1;
if (topEdge || leftEdge || rightEdge || bottomEdge) getWorld().removeObject(this);
}
Actor pointBall;
pointBall = getOneObjectAtOffset(0,0,pointBall.class);
if (pointBall!=null)
{
World background;
background = getWorld();
background.removeObject(pointBall);
}
}
}