這個action庫在我項目里的路徑為:src/framework/cocos2dx/ActionEx.lua
給大家看看它的強大之處
它幫我們把各種函數(shù)再封裝了一遍燎潮,使用時簡單且簡潔
這里放一個我自己寫的demo
local catSprite = display.newSprite("cat.png")
catSprite:setAnchorPoint(0.5,0.5)
catSprite:addTo(self)
catSprite:runAction(
cca.seq({
cca.spawn{cc.BezierTo:create(5,{cc.p(0,0),cc.p(100,4),cc.p(600,800)}),
cca.scaleTo(2, 1.5)},
cca.callFunc(function ()
pigSprite:runAction(cca.seq({
cca.delay(0.2),
cca.spawn({
cca.scaleTo(0.1,1),
}),
cca.spawn({
cca.scaleTo(0.3,0.7),
}),
cca.spawn({
cca.scaleTo(0.3,0.5),
})
}))
catSprite:removeFromParent()
end)
}))
catSprite:runAction(cc.RepeatForever:create(cca.rotateBy(10, 360)))