There is only one method left to see the initial board built. The method checkForMatchesOfType
takes a
desiredGemState
value as a parameter. We do this because, during the initial board setup, we only want to check gems that are in the state kGemNew
. Later, during actual gameplay, we only want to check for matches when the gems are in the state kGemIdle
. (During gameplay, the gems in the kGemNew
state will be outside the visible screen before they are dropped on to the screen, and we definitely do not want to include them in matches until they drop into position.) Let's look at the method now, in two parts:
Filename:
MAPlayfieldLayer.m
(checkForMatchesOfType
, part 1)
-(void) checkForMatchesOfType:(GemType)desiredGemState { // Let's look for horizontal matches for (MAGem *aGem in gemsInPlay) { // Let's grab the first gem if (aGem.gemState == desiredGemState) { // If it is the desired state, let's look // for a matching neighbor gem ...