|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Sprite | +--SpriteShip
The player sprite, controlled by the keyboard.
Field Summary | |
(package private) double |
ageDoneHyperjump
A ship needs an ageDoneHyperjump as well as the Sprite ageDone, uses it for fading out of hyperjumps. |
(package private) double |
ageDoneShootwait
Use the ageShootwait to time the wait between bullets shot. |
(package private) boolean |
down
Key flag for down arrow key pressed. |
(package private) boolean |
firing
Machine-gun firing key. |
(package private) static boolean |
godmode
Use this flag to mean that your ship never dies. |
(package private) boolean |
left
Key flag for left arrow key pressed. |
(package private) static int |
newShipScore
Next score needed to get a new ship. |
(package private) boolean |
right
Key flag for right arrow key pressed. |
(package private) static int |
shipsLeft
Number of ships left in game |
(package private) static int |
TURN_STEP_THRESHOLD
How many turn step updates before you shift into fast turning? |
(package private) int |
turnstepcount
Track how many turn steps you've done on this key press. |
(package private) boolean |
up
Key flag for up arrow key pressed. |
Fields inherited from class Sprite |
acceleration,
active,
age,
ageDone,
angle,
angularAcceleration,
bounce,
edgecolor,
fillcolor,
fillflag,
game,
mass,
maxspeed,
ownerApp,
position,
positiontransform,
radius,
shape,
shapetransform,
soundplaying,
velocity |
Constructor Summary | |
SpriteShip(RealPixelConverter rtopc)
Constructor sets colors, calls reset(). |
Method Summary | |
void |
draw(java.awt.Graphics g,
boolean detail)
This fades the edge from black to white when you have a black fill, as is customary with a black background. |
void |
fire(RealPixelConverter rtopc)
Make a sound and get a blank bullet slot or the oldest bullet slot and put a new bullet in there, aimed in your direction and starting at your location. |
void |
hyperjump()
Randomize your location and give yourself an "immunity" for a few cycles. |
void |
keyPressed(int key)
Process the arrow keys and spacebar. |
void |
keyReleased(int key)
Process the arrow keys and spacebar. |
void |
loopsound(boolean onoff)
Toggles the thrustersSound. |
void |
reset(RealPixelConverter rtopc)
Puts the ship motionless in the middle of the screen. |
void |
stop()
The stop method sets active to false and turns off the sound. |
(package private) double |
turnstep()
A function that returns the slow or fast TURN_STEP depending on turnstepcount. |
void |
update(RealPixelConverter rtopc)
The ship update method rotates the ship if left or right cursor key is down, Fires thrusters if up or down arrow key is down, calls advance and render, counts down the hyperspace counter if ship is in hyperspace. |
Methods inherited from class Sprite |
advance,
explode,
fixRadius,
isColliding,
isTouching,
mass,
radius,
randomizeFillcolor,
render,
setFakeRadius,
wrapandbounce |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int TURN_STEP_THRESHOLD
int turnstepcount
static int newShipScore
static int shipsLeft
boolean left
boolean right
boolean up
boolean down
boolean firing
double ageDoneHyperjump
double ageDoneShootwait
static boolean godmode
Constructor Detail |
public SpriteShip(RealPixelConverter rtopc)
Method Detail |
double turnstep()
public void reset(RealPixelConverter rtopc)
public void loopsound(boolean onoff)
public void update(RealPixelConverter rtopc)
public void stop()
public void fire(RealPixelConverter rtopc)
public void hyperjump()
public void keyPressed(int key)
public void keyReleased(int key)
public void draw(java.awt.Graphics g, boolean detail)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |