Game Development Reference
In-Depth Information
}
}
// Draw the guided missile,
if (missile.active) {
missile.draw(canvas, mPaint);
}
// Draw the flying saucer.
if (ufo.active) {
ufo.draw(canvas, mRedPaint);
}
// Draw the ship
if (ship.active) {
// draw ship
ship.draw(canvas, mPaint);
// Draw thruster exhaust if thrusters are on. Do it randomly to get
// a flicker effect.
if (!paused && Math.random() < 0.5) {
if (up) {
fwdThruster.draw(canvas, mPaint);
}
if (down) {
revThruster.draw(canvas, mPaint);
}
}
}
// Draw the asteroids.
for (i = 0; i < Constants.MAX_ROCKS; i++) {
if (asteroids[i].active) {
asteroids[i].draw(canvas, mGreenPaint);
}
}
// Draw any explosion debris.
for (i = 0; i < Constants.MAX_SCRAP; i++) {
if (explosions[i].active) {
explosions[i].draw(canvas, mGreenPaint);
}
}
// Display status messages.
float fontSize = mPaint.getTextSize();
// upper left
canvas.drawText("Score: " + score, fontSize, mPaint.getTextSize(),
mPaint);
Search WWH ::




Custom Search