public class Cannonball
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
FRAME_RATE
Number of frames displayed per second
|
static double |
GRAVITY
Acceleration of gravity
|
static double |
RADIUS
Radius of ball
|
Constructor and Description |
---|
Cannonball()
Default constructor creates a new Cannonball with initial angle 45 degrees, initial speed 1
|
Cannonball(double angle,
double speed)
Creates a new Cannonball with specified initial angle (degrees) and initial speed (ft/s)
|
Modifier and Type | Method and Description |
---|---|
void |
fire()
Fires this Cannonball
|
void |
setAngle(double angle)
Sets this Cannonball's firing angle to a specified amount
|
void |
setSpeed(double speed)
Sets this Cannonball's firing speed to a specified amount
|
double |
vx()
Returns the initial speed of this Cannonball
|
double |
vy()
Returns the initial angle of this Cannonball
|
public static double GRAVITY
public static double RADIUS
public static double FRAME_RATE
public Cannonball()
public Cannonball(double angle, double speed)
public void fire()
public double vx()
public double vy()
public void setAngle(double angle)
angle
- the desired firing angle in degreespublic void setSpeed(double speed)
speed
- the desired firing speed in ft/s