|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AsteroidsGame
This container class holds a spritevector with all the sprites, and keeps the SpriteBullet and SpriteExplosion in separate arrays so we can conveniently replace the oldest one when we want to make a new one.
Field Summary | |
(package private) SpriteAsteroid[] |
asteroids
The asteroids. |
(package private) int |
bulletIndex
|
(package private) SpriteBullet[] |
bullets
Use a phtons array so that we can always replace the oldest bullet by the newest bullet. |
(package private) boolean |
collideflag
Flag for whether or not to calculate collisions between asteroids. |
(package private) boolean |
diskflag
Flag for whether to use a rectangle or a disk for your world. |
(package private) int |
explosionIndex
|
(package private) SpriteExplosion[] |
explosions
So that we can always replace the oldest explosion line by the newest one, we need an array for the explosions. |
(package private) boolean |
gameonflag
Flag to indicate if game is started and not yet over. |
(package private) static int |
highScore
High score for this play session. |
(package private) static int |
MAX_ASTEROIDS
Number of asteroids that you can get by splitting up. |
(package private) static int |
MAX_BULLETS
Number of active bullets allowed. |
(package private) static int |
MAX_EXPLOSIONS
Total number of lines used to represent exploding objects. |
(package private) static int |
MAX_SHIPS
Starting number of ships per game. |
(package private) SpriteMissile |
missile
The missile. |
(package private) static int |
NEW_SHIP_POINTS
Number of additional points needed to earn a new ship. |
(package private) static int |
NEW_UFO_POINTS
Number of additional points before a fresh Ufo attacks. |
(package private) boolean |
paused
Flag for paused game. |
(package private) static int |
score
Game score. |
(package private) SpriteShip |
ship
It's useful to have a distinguished name for the ship. |
(package private) java.util.Vector |
spritevector
The spritevector holds all of the sprites; we walk this array for our updates. |
(package private) static double |
STARDENSITY
Number of stars per square world unit. |
(package private) Vector2Colored[] |
stars
Array for background stars |
(package private) static int |
START_ASTEROIDS
Number of asteroids in each wave. |
(package private) SpriteUfo |
ufo
The flying saucer. |
(package private) SpriteWall |
wall
Have a SpriteWall to show when the bounce is on for the ship. |
Constructor Summary | |
AsteroidsGame(RealPixelConverter rtopc)
Construct all your sprites and add them to spritevector. |
Method Summary | |
(package private) void |
draw(java.awt.Graphics g,
RealPixelConverter rtopc,
boolean detail)
Fill in background stars, draw the sprites. |
void |
gameUpdate(double dt,
RealPixelConverter rtopc)
First call advance for all sprites, then render for all sprites, and then update for all sprites. |
boolean |
getBounce()
|
void |
makenewstars()
|
(package private) SpriteAsteroid |
nextAsteroid()
This returns the slot of the next non-live asteroid, or null if there's no slot. |
(package private) SpriteBullet |
nextBullet()
|
(package private) SpriteExplosion |
nextExplosion()
|
void |
resetAsteroids(RealPixelConverter rtopc)
Create START_ASTEROIDS asteroids, make them faster than before, put them out at the edge of the screen, and set SprieAsteroidpauseCounter. |
void |
resetBullets(RealPixelConverter rtopc)
|
void |
resetExplosions(RealPixelConverter rtopc)
|
void |
resetGame(RealPixelConverter rtopc)
Initialize the game data. |
(package private) void |
setOwnerApp(Asteroids owner)
|
void |
stop()
Stop ship, flying saucer, guided missile and associated sounds. |
void |
toggleBounce()
|
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int MAX_SHIPS
static final int MAX_BULLETS
static final int START_ASTEROIDS
static final int MAX_ASTEROIDS
static final int MAX_EXPLOSIONS
static final int NEW_SHIP_POINTS
static final int NEW_UFO_POINTS
static double STARDENSITY
Vector2Colored[] stars
static int score
static int highScore
boolean gameonflag
boolean paused
boolean collideflag
boolean diskflag
SpriteWall wall
java.util.Vector spritevector
SpriteShip ship
SpriteBullet[] bullets
int bulletIndex
SpriteUfo ufo
SpriteMissile missile
SpriteAsteroid[] asteroids
SpriteExplosion[] explosions
int explosionIndex
Constructor Detail |
public AsteroidsGame(RealPixelConverter rtopc)
Method Detail |
public void resetGame(RealPixelConverter rtopc)
public void makenewstars()
public void stop()
SpriteExplosion nextExplosion()
SpriteBullet nextBullet()
SpriteAsteroid nextAsteroid()
public void resetBullets(RealPixelConverter rtopc)
public void resetAsteroids(RealPixelConverter rtopc)
public void resetExplosions(RealPixelConverter rtopc)
public void toggleBounce()
public boolean getBounce()
public void gameUpdate(double dt, RealPixelConverter rtopc)
void draw(java.awt.Graphics g, RealPixelConverter rtopc, boolean detail)
void setOwnerApp(Asteroids owner)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |