Java Reference
In-Depth Information
Now we are going to have a quick look at what we have managed to
cover in under 150 lines of Java ME code.
8.2.1 What Has It Got?
No argument - this game won't be on any best-seller list but let's see
some of the things this simple game demonstrates:
Loading and displaying an image from a JAR file (lines 25 and 26)
Creating a Sprite instance from an image file (line 26)
A basic game loop using a thread (lines 48-60)
Using a full screen GameCanvas (lines 20 and 21)
Examining key states to respond to user input (lines 115, 117 and 121)
Moving and rotating Sprites (lines 79-83)
A simple way to generate random numbers over a fixed interval (lines
136-138)
Basic layer management using the LayerManager class (lines 95,
99-109)
Basic MIDP 2.0 Media API tone sequences (lines 14-17, 32-35 and
100-105)
Responding to softkey events (lines 130-134)
Collision detection between Sprites (line 97).
It has to be said that, once you get used to the Game API, you will see
that almost all of these features came for free. The bulk of this game is
made up of simple code snippets that glue together pre-packaged MIDP
2.0 game functionality.
8.2.2 What Has It Not?
At first glance it isn't too bad for a first pass. However there are a number
of things that this game lacks. Some of the missing features can be classed
as 'nice to have' but quite a few are core and represent common errors
made in mobile game development.
Obviously it doesn't have menus, a splash screen, score tracking or
advanced media. It doesn't use any particular architecture, would be hard
to maintain and is a little casual with its memory management. Here are
some other problems:
It does not handle pausing of the game in any way.
Search WWH ::




Custom Search