Game Development Reference
In-Depth Information
if (self.addingCombos == true) then
if (#self.gridController.matchArray > 3)
then self.combos = self.combos +
(#self.gridController.matchArray - 3) end
end
self.gridAnimations:animateMatches
(self.gridController.matchArray, onMatchedAnimatedOut)
self:showMatchParticle
(self.gridController.matchArray)
self:setGemsScore(#self.gridController.matchArray *
constants.POINTS)
self:playFX("match.wav")
5. Then, if we find no more matches, we replace some random gems with diamonds
if the value for combos is above 0 (meaning we had more than a 3 gem match in
the last player's move):
else
--no more matches, check for combos
if (self.combos > 0) then
--now turn random gems into diamonds
local diamonds = {}
local removeGems = {}
local i = 0
math.randomseed(os.clock())
while i < self.combos do
i = i + 1
local randomGem = nil
local randomX,randomY = 0
while randomGem == nil do
randomX = math.random(1,
constants.GRID_SIZE_X)
randomY = math.random(1,
constants.GRID_SIZE_Y)
randomGem =
self.gridGemsColumnMap[randomX][randomY]
if (randomGem.type ==
Search WWH ::




Custom Search