Playfield Methods - Motorola C370 Series Technical Manual

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

Advertisement

8
Gaming API and Sound
PlayField are all empty (tile 0 - a reserved tile and represents an empty square). A tile
set can later be added using setStaticTileSet().

PlayField Methods

The
PlayField
public void addSprite(Sprite s) throws
NullPointerException – Add a Sprite to the PlayField. Ignores the request
if the Sprite is already associated with the PlayField.
public void removeSprite(Sprite s) throws
RuntimeException, NullPointerException – Remove a Sprite from PlayField.
public void removeAllSprites() – Remove all Sprites from
PlayField.
public int createAnimatedTile(int staticTileIdx)
throws IndexOutOfBoundsException – Creates a new animated tile and
initializes it with a static tile index. Returns the index to use when referring to this
animated tile. The indices for animated tiles will be negative (<0) and the indices for
the static tile set will be positive (>=0). The index sets do not overlap and therefore
indices for static and animated tiles can be used interchangeably in the methods that
set or move the contents of the PlayField cells. The first animated tile shall have the
index -1, the second, -2, etc.
public void setAnimatedTileImage(int animTileIdx,
int staticTileIdx) throws IndexOutOfBoundsException –
Sets the static tile that will be displayed in any cell that contains the animated tile.
The method parameters are
staticTileIdx
public int getAnimatedTileImage(int animTileIdx)
throws IndexOutOfBoundsException – Get the static tile referenced by an
animated tile, and returns the index of the static tile that is currently referenced by an
animated tile.
public void setCell(int celCol, int celRow,
int tileIdx) throws IndexOutOfBoundsException,
ArrayIndexOutOfBoundsException – Sets the tile to be displayed in a
cell. The tile can be either a static or an animated tile. The method parameters are
celCol
of tile to place in cell.
public int getCell(int celCol, int celRow)
throws.ArrayIndexOutOfBoundsException – Gets the index of the
static or animated tile currently displayed in a cell.
public void moveTiles(int dstCol, int dstRow,
int srcCol, int srcRow, int width, int height) throws
ArrayIndexOutOfBoundsException – Move a rectangular set of tiles
from a source location to a destination location. Source cells are left empty. If the
class defines the following methods:
animTileIdx
- index of a static tile to be referenced by the animated tile.
- column of cell to set,
celRow
- index of the animated tile, and
- row of cell to set, and
tileIdx
- index
51

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents