Motorola C550 ユーザーズマニュアル

ページ / 86
 
source and destination cells overlap, the method shall behave as if the source cells 
are first copied to a separate array, the source cells are cleared, and the tiles are 
then copied back to the destination cells. The method parameters are the following: 
dstCol
 - column of top-left destination cell; 
dstRow
 - row of top-left destination 
cell; 
srcCol
 - column of top-left source cell; 
srcRow
 - row of top-left source cell; 
width
 - width, in rows, of area of tiles to move; and 
height
 - height, in rows, of 
area of tiles to move. 
• 
public void fillCells(int col, int row, int width, int height, int tileIdx) throws 
IndexOutOfBoundsException, ArrayIndexOutOfBoundsException – Fill each cell in a 
rectangular area with a given animated or static tile. The method parameters are the 
following: 
col
 - column of top-left cell; 
row
 - row of top-left cell; 
width
 - width, in 
rows, of area of cells to fill; 
height
 - height, in rows, of area of cells to fill; and 
tileIdx
 - index of tile to place in fill region. 
• 
public void 
draw(javax.microedition.lcdui.Graphics g, int x, 
int y)
 throws 
NullPointerException
 – Draw the PlayField to a 
Graphics instance, anchoring the top left corner of the PlayField view window at the 
position 
(x, y)
 on the Graphics instance. The method parameters are the 
following: 
g
 - Graphics instance on which to draw the PlayField; 
x
 - the x coordinate 
of the top left corner of the PlayField; and 
y
 - the y coordinate of the top left corner of 
the PlayField. The PlayField will be drawn as follows: 
• 
Draw all the 
Sprites
 with depth < 0 in increasing order of depth (depth -2 drawn 
before or below depth -1); 
• 
Draw the tiles for all cells. Empty cells, those with Tile 0, are considered fully 
transparent, so nothing is drawn for them. 
• 
Draw the all the 
Sprites
 with depth >= 0 in increasing order of depth (depth 1 
drawn before or below depth 2). The location of the Sprites is defined by the 
Sprite
 instance and is relative to the top left corner of the 
PlayField
 grid. 
• 
public int getCellWidth()
 –  Get width of a cell, in pixels. 
• 
public int getCellHeight()
 – Get height of a cell, in pixels. 
• 
public int getGridWidth() 
– Get width of the PlayField grid, in cells. 
• 
public int getGridHeight()
 – Get height of the PlayField grid, in cells. 
• 
public boolean anyCollisions()
 – This method checks whether any 
of the PlayField's Sprites collide with any of the PlayField's tiles or other Sprites on 
the PlayField. It will return 
true
 if any Sprite on the PlayField collides with a tile or 
any other Sprite. Like collidesWithSprites(Sprite) and collidesWithAnyTile(Sprite), this 
method reports collisions only at a boundary level granularity, not pixel level 
granularity. 
• 
public boolean collidesWithSprites(Sprite s)
 throws 
NullPointerException
 – Check for Sprite collision with any other Sprites 
on the PlayField. This method is complemented by Sprite.collidesWith(Sprite, 
boolean); If collidesWithSprites(Sprite) returns true, the developer can find the exact 
Sprite collision(s) by using Sprite.collidesWith(Sprite, boolean). This is similar to how