public class Velocity
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
double | 
x
velocity in x direction. 
 | 
double | 
y
velocity in y direction. 
 | 
| Constructor and Description | 
|---|
Velocity()
Creates a new object with an velocity of 0. 
 | 
Velocity(double x,
        double y)
Creates a new object with the given velocity components. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Direction | 
direction()
Determines the direction of the current velocity vector. 
 | 
void | 
setVelocity(Direction direction,
           double speed)
Sets the velocity in the given direction. 
 | 
void | 
setVelocity(Direction direction,
           int speed)
Sets the velocity in the given direction. 
 | 
public Velocity()
public Velocity(double x,
                double y)
x - component in x directiony - component in y directionpublic Direction direction()
public void setVelocity(Direction direction, double speed)
direction - the directionspeed - the absolute value of the velocitypublic void setVelocity(Direction direction, int speed)
direction - the directionspeed - the absolute value of the velocity