public class Ball
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
x
The x axis position of the ball.
|
private int |
xSpeed
The speed of the ball on the x axis.
|
private int |
y
The y axis position of the ball.
|
private int |
ySpeed
The speed of the ball on the y axis.
|
Constructor and Description |
---|
Ball()
Initializes the Ball to have position zero and velocity of 0;
|
Modifier and Type | Method and Description |
---|---|
int |
getX()
Gets the x position of the ball.
|
int |
getY()
Gets the y position of the ball.
|
void |
update()
Updates the physics of the ball.
|
void |
updateDirection(Direction direction)
Changes the speed of the ball based on the direction.
|
private int x
private int y
private int xSpeed
private int ySpeed
public int getX()
public int getY()
public void update()
public void updateDirection(Direction direction)
direction
- The direction in which to change the speed.