xPosition = xPosition + xspeed;
yPosition = yPosition + yspeed;
MyWorld w = (MyWorld) getWorld();
if (getOneIntersectingObject(brick.class) != null)
{
setImage(new GreenfootImage("brick.png"));
setLocation(this.getX(), this.getY());
w.allowBallLaunch();
return;
}
if (getY() == getWorld().getHeight()-1)
{
w.allowBallLaunch();
this.setLocation(this.getX(), this.getY());
return;
}
if (xPosition >= getWorld().getWidth()-1)
{
getWorld().removeObject(this);
return;
}
if (yPosition <= 0 || yPosition >= getWorld().getHeight()-1)
{
this.setImage(this.buildUpArrowImage());
w.allowBallLaunch();
}
if (yPosition <= 0 || yPosition >= getWorld().getHeight()-1)
{
w.allowBallLaunch();
return;
}
if (getOneIntersectingObject(StickyBall.class)!=null)
{
setLocation(this.getX(), this.getY());
w.allowBallLaunch();
return;
}
