49 lines
1010 B
Java
49 lines
1010 B
Java
public class GoodThreadBall {
|
|
|
|
/**the radius of the ball*/
|
|
public static final int BALL_RADIUS = 8;
|
|
|
|
/**the x location of the ball*/
|
|
private int xPos;
|
|
|
|
/**the y location of teh ball*/
|
|
private int yPos;
|
|
|
|
|
|
/**
|
|
* creates a new ball given the starting x and y position
|
|
*/
|
|
public GoodThreadBall (int xPos, int yPos) {
|
|
this.xPos = xPos;
|
|
this.yPos = yPos;
|
|
}
|
|
|
|
|
|
/**
|
|
* updates the the ball to move to the right
|
|
*/
|
|
public void update() {
|
|
|
|
this.xPos++;
|
|
if (xPos > 600) {
|
|
xPos = 0;
|
|
}
|
|
|
|
} //end update
|
|
|
|
|
|
/**
|
|
* gets the x location
|
|
*/
|
|
public int getXPos() {
|
|
return this.xPos;
|
|
}
|
|
|
|
/**
|
|
* gets the y location
|
|
*/
|
|
public int getYPos() {
|
|
return this.yPos;
|
|
}
|
|
|
|
} //end class good thread bal |