Game Development Reference
In-Depth Information
chimneyX[1] = 0.5f;
num_chimneys = 2;
break;
}
7. The method then proceeds to position the visible chimneys. And we finally move
to texturing the building. The logic to texture the roof and wall tiles is the same;
for instance, here's how the walls are tiled by changing the texture of each wall
sprite through the setDisplayFrame method and then turning unused tiles in-
visible:
count = _wallTiles->count();
for (i = 0; i < count; i++) {
tile = (Sprite *) _wallTiles->objectAtIndex(i);
if (tile->getPositionX() < _width && tile
->getPositionY() > -_height) {
tile->setVisible(true);
tile->setDisplayFrame(wallFrame);
} else {
tile->setVisible(false);
}
}
}
Search WWH ::




Custom Search