}
/**
* 创建海底沙地背景图层
*/
protected void createSandBackground(){
Image bottomTitles = SubMIDlet.createImage("/res/bottom.png");
//将图片bottomTitles切成指定大小(TILE_WIDTH, TILE_HEIGHT)
//创建一个指定维数(1, WIDTH_IN_TILES)的背景数组
TiledLayer layer = new TiledLayer(WIDTH_IN_TILES, 1,
bottomTitles, TILE_WIDTH, TILE_HEIGHT);
for(int column = 0; column < WIDTH_IN_TILES; column++){
//将海底图层数组中的每个小格用原始图片的第i块来填充
int i = SubMIDlet.createRandom(NUM_DENSITY_LAYER_TILES) + 1;
layer.setCell(column, 0, i);
}
layer.setPosition(0, WORLD_HEIGHT - bottomTitles.getHeight());
layerManager.append(layer);
bottomTitles = null;
}
/**
* 创建海底水层背景图片
*/
protected void createSeaBackground(){