How can i make, after the ball hit the left/right edge, the new ball move in the that direction (if the ball hit the left edge, the new ball start moving in the left side)
public void remove()
{
PongWorld world = (PongWorld) getWorld();
if(getX() > 795)
{
Score(1);
getWorld().removeObject(this);
Greenfoot.delay(5);
world.addObject(new Ball(), 400, 300);
}
else
{
if(getX() < 5)
{
Scoree(1);
getWorld().removeObject(this);
Greenfoot.delay(5);
world.addObject(new Ball(), 400, 300);
}
}
}
i tried this but every time the ball start moving in the right side; a little help here?

