Playfield Class; Using Static And Animated Tiles - Motorola C370 Series Technical Manual

J2me developer guide
Hide thumbs Also See for C370 Series:
Table of Contents

Advertisement

raceCar.setPaletteEntry(0, 0x0000FF);
Image blueRaceCar = raceCar.getImage();
// Set the car color to green and retrieve the Image
raceCar.setPaletteEntry(0, 0x00FF00);
Image greenRaceCar = raceCar.getImage();
// The PaletteImage can now be discarded since we have the
// Image objects that we need
raceCar = null;

PlayField Class

A
PlayField
cells and a set of associated Sprites.
The
PlayField
and columns are defined by parameters to the constructor. The cells are equally sized.
The size of the cells is defined by the size of the tiles, or if the
by arguments to the constructor. Each cell is either empty or contains a single tile whose
image will be drawn in that cell. An empty cell is fully transparent - Nothing will be drawn
in that area by the
The tiles used to fill the
are referred to using index numbers. Tile 0 (tile with index 0) refers to the special empty
tile. Any cell assigned the tile 0 will be considered empty and will be effectively
transparent.
The static tile indices are non-negative (>=0) and the animated tiles indices are negative
(<0).

Using Static and Animated Tiles

Static tiles are called static because their image does not often change, i.e., any cell that
contains the static Tile 1 will always be drawn as the unchanging image of Tile 1. Tile 0 is
a special static tile. It represents an empty cell. Any cell containing tile 0 will be
transparent, it will not have a tile image drawn in it.
Animated tiles are called animated because their appearance changes easily over time.
At any given time, each animated tile is associated with a particular static tile. When a cell
containing an animated tile is drawn, the image of the static tile currently referenced by
that animated tile will be drawn in that cell. In effect, the animated tiles provide indirect
references to the set of static tiles, and therefore allow many cells to be animated
simultaneously. For example, cells (0,0) and (0,1) both contain animated Tile -2. Animated
Tile -2 currently references static Tile 1. Cells (0,0) and (0,1) will then be drawn with the
image of static Tile 1. If animated Tile -2 is subsequently set to reference static Tile 2 by
is a rectangular grid of cells with a set of available tiles to place in those
grid is made up of (rows * columns) cells, where the number of rows
.
PlayField
cells can be either static tiles or animated tiles. Tiles
PlayField
has no tiles,
PlayField

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents