Java Reference
In-Depth Information
private void createBoard( String imageName )
throws IOException {
Image boardImage = Image.createImage(imageName);
board = new TiledLayer( boardWidth, boardHeight,
boardImage, tileWidth, tileHeight);
for( int i = 0; i < map.length; i++ ) {
intx=i%boardWidth;
inty=i/boardHeight;
board.setCell(x, y, map[i]);
}
layers.append(board);
}
private void createButterflies( String imageName )
throws IOException {
Image image = Image.createImage(imageName);
int x, y, i;
butterfly = new Sprite[2];
for ( i=0; i<butterfly.length; i++ ) {
butterfly[i] = new Sprite(image, tileWidth, tileHeight);
x = random.nextInt(boardWidth)*tileWidth;
y = random.nextInt(boardHeight)*tileHeight;
butterfly[i].setPosition(x,y);
butterfly[i].defineReferencePixel(0,0);
butterfly[i].setTransform(Sprite.TRANS_NONE);
butterfly[i].setFrameSequence(flightSequence);
butterfly[i].setFrame(i % 3);
layers.append(butterfly[i]);
}
}
private void createCat( String imageName )
throws IOException {
Image image = Image.createImage(imageName);
int x, y;
int i;
 
Search WWH ::




Custom Search