Motorola C370 Series Technical Manual page 53

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

Advertisement

8
Gaming API and Sound
collidesWithAnyTile(Sprite) and collidesWithTiles(int, int, int, int, Sprite, boolean)
complement each other. Sprite
The collision detection will proceed as if the Sprite is on the PlayField. That is, its
location will be treated as relative to the origin of the PlayField's coordinate system.
public boolean collidesWithAnyTile(Sprite s) throws
NullPointerException – Check for Sprite collision with PlayField tiles.
Return true if the Sprite overlaps with a cell that contains a tile (i.e. a cell containing a
non-zero tile index). Sprite
collision detection will proceed as if the Sprite is on the PlayField. That is, its location
will be treated as relative to the origin of the PlayField's coordinate system.
public boolean collidesWithTiles(int col, int row, int width, int height, Sprite s,
boolean pixelLevel) throws NullPointerException, ArrayIndexOutOfBoundsException
– Check for Sprite collision with a region of PlayField tiles. It returns true if the Sprite
overlaps with a cell in the defined region that contains a tile (i.e. a cell containing a
non-zero tile index). If
when opaque Sprite pixels overlap opaque tile pixels. This method complements the
collidesWithAnyTile(Sprite) method by letting the programmer focus their search and
find specific tiles or regions of collision. This is similar to how
Sprite.collidesWith(Sprite, boolean) complements collidesWithSprites(Sprite). The
method parameters are the following:
region;
rows, of area for collision check;
- Sprite to check for collision; and
s
collision detection should be done at a pixel level instead of simply as boundary
checks.
public void setStaticTileImage(int staticTileIdx,
Image img, int x, int y) throws NullPointerException,
ArrayIndexOutOfBoundsException – Modify the image associated with
a static tile. Replace the image currently associated with a static tile with a new image
of the same size. New static tile image will be extracted from the image passed in,
starting from pixel
pixels horizontally and getCellHeight() pixels vertically. As at tile set creation time, if a
mutable source image is used, behavior of the tile set should be as if the new image
were cached. Updates to the mutable source image will not cause a change in the
appearance of the tile image.
public void setStaticTileSet(Image img, int tWidth,
int tHeight) throws NullPointerException,
IllegalArgumentException – Replaces the current static tile set with a
new static tile set. See the constructor PlayField(int, int, Image, int, int) for information
on how the tiles are created from the image. If the new static tiles have the same
dimensions as the previous static tiles, the view window will be unchanged. If the new
static tiles have different dimensions than the previous static tiles, the view window
will be reset to the construction default, i.e. the entire grid dimension. If the new static
tile set has as many or more tiles than the previous static tile set, then the animated
tiles will be unchanged, and the contents of the PlayField grid will be unchanged. If
the new static tile set has less tiles than the previous static tile set, then the PlayField
grid will be reset to completely empty, and All animated tiles will be deleted.
s
does not have to have been added to the PlayField. The
s
pixelLevel
- Column of top-left cell for collision check region;
col
width
in the new source image and extending for getCellWidth()
(x, y)
does not have to have been added to the PlayField.
is true, this method will report a collision only
- Row of top-left cell for collision check
row
- Width, in rows, of area for collision check;
- Boolean indicating whether
pixelLevel
- Height, in
height
53

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents