Game Development Reference
In-Depth Information
Combos are used to track if we have more than 3 gems
matched after the player's move.
--check for new matches
if (self.gridController:checkGridMatches() ==
true) then
2. If we have a match, we run animations on the matched gems, otherwise we play a
swap back animation and play a sound effect to represent a wrong move by the
player:
--animate matched gems
if (#self.gridController.matchArray > 3)
then self.combos = self.combos +
(#self.gridController.matchArray - 3) end
self.gridAnimations:animateMatches
(self.gridController.matchArray, onMatchedAnimatedOut)
self:showMatchParticle
(self.gridController.matchArray)
self:setGemsScore(#self.gridController.matchArray *
constants.POINTS)
self:playFX("match2.wav")
else
--no matches, swap gems back
self.gridAnimations:swapGems
(self.targetGem, self.selectedGem,
onReturnSwapComplete)
self.gridGemsColumnMap[self.targetIndex.x][self.targetIndex.y]
= self.targetGem
self.gridGemsColumnMap[self.selectedIndex.x][self.selectedIndex.y]
= self.selectedGem
self.grid[self.targetIndex.x][self.targetIndex.y] =
self.targetGem.type
self.grid[self.selectedIndex.x][self.selectedIndex.y]
= self.selectedGem.type
Search WWH ::




Custom Search