Game Development Reference
In-Depth Information
self.gameLayer.gridAnimations:animateSelected
(touchedGem.gem)
end
end
We start the swapping process; we have a selected gem but no target gem. We
change the layering of the selected gem through setLocalZOrder . We also
make the selected gem rotate 360 degrees.
9. Then, we're ready to select the target gem:
function GridController:selectTargetGem (touchedGem)
if (self.gameLayer.targetGem ~= nil) then return
end
self.enabled = false
self.gameLayer.targetIndex = {x = touchedGem.x,
y = touchedGem.y}
self.gameLayer.targetGem = touchedGem.gem
self.gameLayer.targetGem:setLocalZOrder(constants.Z_SWAP_1)
self.gameLayer:swapGemsToNewPosition()
end
It is now that we finally call our GameScene class and ask it to swap the gems.
Search WWH ::




Custom Search