The SpaceMission MIDlet is a 3D game where the user shoots aliens on a space planet.
The following figure shows the splash screen that is displayed when the MIDlet is launched.
Figure: SpaceMission splash screen
During the game, the user can move around the planet using the device keyboard. The mission is to shoot (freeze) aliens while remaining on the planet surface (if the user steps off the edge of the planet, the game ends).
Figure: Playing the game
To win the game, the user must freeze all the aliens on the planet.
Figure: Winning the game
The MIDlet consists of the following classes:
GameMIDlet
—MIDlet main class, which starts
up the MIDlet and loads some static objects, such as images.
GameStatusListener
—Defines the reasons why
the game ended.
SplashScreenView
—Represents the splash screen
that is shown when the MIDlet is started and the game is loading.
GameCanvasView
—Draws the game elements on
the screen. The class keeps a record of the current score, checks
for user input, and continuously updates the game status and game
screen using a thread.
FloorTiles
—Draws a background image that is
repeated from a number of small tiles (in practice, the surface of
the planet, which is made up of a number of tiles representing different
areas of the terrain). The class constructs a Mesh
object, which is returned by the getFloorMesh
method.
PlayerModel
—Keeps track of all player-related
data, like position and direction. The class also updates this data
when it receives a notification that a key has been pressed.
Game3DManager
—Constructs the 3D scene graph
used in the game and changes the game state depending on the user
input (key presses or touch input). The class also checks for any
collisions between the user and the 3D objects in the scene.
AlienModel
—Constructs a Mesh
that represents an alien.
GameSoundManager
—Loads the MIDI and sound
files used in the game, and plays any tones needed by the game.
Softkey
—Adds custom softkeys to the MIDlet
UI.
For information about implementing the MIDlet, see section Implementation.