这个action库在我项目里的路径为:src/framework/cocos2dx/ActionEx.lua
给大家看看它的强大之处
它帮我们把各种函数再封装了一遍,使用时简单且简洁
这里放一个我自己写的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)))
网友评论