There are a few changes to the way the initBlock
method runs now:
Each block will store references to four different types of texture, representing the four types of buildings used in the game (
_tile1
,_tile2
,_tile3
, and_tile4
). So we now store that information in theinitBlock
method:void Block::initBlock() { _tile1 = SpriteFrameCache::getInstance()- >getSpriteFrameByName ("building_1.png"); _tile2 = SpriteFrameCache::getInstance()- >getSpriteFrameByName ("building_2.png"); _tile3 = SpriteFrameCache::getInstance()- >getSpriteFrameByName ("building_3.png"); _tile4 = SpriteFrameCache::getInstance()- >getSpriteFrameByName ("building_4.png");
Each block also stores references to two types of textures for the building roof tile (
_roof1
and_roof2
):_roof1 = SpriteFrameCache::getInstance()-> getSpriteFrameByName ("roof_1.png"); _roof2 = SpriteFrameCache::getInstance()- >getSpriteFrameByName ("roof_2.png");
Next, we create and...