Java Reference
In-Depth Information
Figure 2.7 Image split into 135 tiles
lake. The dimensions of the image are 360
×
315 pixels and each tile's
dimension is 24
×
35 pixels; that gives us a total of 135 tiles which can
be treated as a 15
×
9 array (see Figure 2.7) and manipulated to create
our background.
We put TiledLayer scrolling backgrounds into use later on, with a
LayerManagerDemo example.
Sprite
A Sprite is a basic visual element suitable for creating animations and
consists of an image composed of several smaller images (frames). The
Sprite can be rendered as one of the frames. By rendering different
frames in a sequence, a Sprite provides animation. Let us consider a
simple example. Figure 2.8 consists of 12 frames of the same width and
height. By displaying some of the frames in a sequence, we can produce
an animation.
Here's how to create and animate a sprite based on the image in
Figure 2.8. The code is abbreviated for clarity and we will see a more
complete example in the LayerManagerDemo MIDlet:
Search WWH ::




Custom Search