Game Development Reference
In-Depth Information
constants.TYPE_GEM_WHITE) then randomGem = nil end
end
6. And we pick random gems for the diamonds:
local diamond = self.objectPools:getDiamond()
diamond:setPosition(randomGem:getPositionX(),
randomGem:getPositionY())
local diamondParticle =
self.objectPools:getDiamondParticle()
diamondParticle:setPosition(randomGem:getPositionX(),
randomGem:getPositionY())
table.insert(diamonds, diamond)
table.insert(removeGems, {x=randomX,
y=randomY})
end
self:setDiamondScore(#diamonds *
constants.DIAMOND_POINTS)
Animate the diamonds being collected, and at the end of that animation, call back
onMatchedAnimatedOut , which will collapse the grid once more now that
we had gems "burst" into diamonds:
self.gridAnimations:animateMatches(removeGems,
onMatchedAnimatedOut)
self.gridAnimations:collectDiamonds(diamonds)
self.combos = 0
self:playFX("diamond2.wav")
else
self.gridController.enabled = true
end
self.addingCombos = false
end
end
7. Here's the whole collapseGrid method:
Search WWH ::




Custom Search