Game Development Reference
In-Depth Information
SpriteFrame * roofFrame = rand() % 10 > 6 ? _roof1
: _roof2;
int num_chimneys;
float chimneyX[] = {0,0,0,0,0};
6. Then, based on building type, we give different x positions for the chimney
sprites and determine the texture we'll use on the wall tiles:
switch (type) {
case kBlockGap:
this->setVisible(false);
return;
case kBlock1:
wallFrame = _tile1;
chimneyX[0] = 0.2f;
chimneyX[1] = 0.8f;
num_chimneys = 2;
break;
case kBlock2:
wallFrame = _tile2;
chimneyX[0] = 0.2f;
chimneyX[1] = 0.8f;
chimneyX[2] = 0.5f;
num_chimneys = 3;
break;
case kBlock3:
wallFrame = _tile3;
chimneyX[0] = 0.2f;
chimneyX[1] = 0.8f;
chimneyX[2] = 0.5f;
num_chimneys = 3;
break;
case kBlock4:
wallFrame = _tile4;
chimneyX[0] = 0.2f;
Search WWH ::




Custom Search