Game Development Reference
In-Depth Information
local action = cc.Sequence:create (delay,
moveTo, cc.CallFunc:create(removeDiamond))
diamonds[i]:runAction(action)
end
end
This moves the diamonds to where the diamond score label is.
5. And now, finally, add the grid collapse:
function GridAnimations:animateCollapse ( onComplete )
self.animatedCollapsedGems = 0
local gem = nil
local drop = 1
for c = 1, constants.GRID_SIZE_X do
drop = 1
for r = 1, constants.GRID_SIZE_Y do
gem =
self.gameLayer.gridGemsColumnMap[c][r]
--if this gem has been resized, move it
to the top
if (gem.gemContainer:getScaleX() ~= 1)
then
gem:setPositionY((constants.GRID_SIZE_Y + (drop)) *
(constants.TILE_SIZE + constants.GRID_SPACE))
self.animatedCollapsedGems =
self.animatedCollapsedGems + 1
gem:setType (
self.gameLayer:getNewGem() )
gem:setVisible(true)
local newY = (constants.GRID_SIZE_Y
- (drop - 1)) * (constants.TILE_SIZE +
constants.GRID_SPACE)
self:dropGemTo (gem, newY, 0.2,
onComplete)
drop = drop + 1
else
if (drop > 1) then
self.animatedCollapsedGems =
Search WWH ::




Custom Search