前端之家收集整理的这篇文章主要介绍了
图片帧动画-Quick-Cocos2dx,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
图片帧动画
效果如下:
local frames = {
cc.SpriteFrame:create("res/bone/10001/100010.png",cc.rect(2,116,101,117)),cc.SpriteFrame:create("res/bone/10001/100010.png",2,112,112)),338,103,107),true,cc.p(0,0),cc.p(103,107)),235,112),cc.p(101,112))
}
local horse = cc.Sprite:createWithSpriteFrame(frames[1])
self:addChild(horse)
horse:setPosition(200,200)
local animation = cc.Animation:create()
animation:setDelayPerUnit(0.1)
for i,frame in pairs(frames)do
animation:addSpriteFrame(frame)
end
horse:runAction(cc.RepeatForever:create(cc.Animate:create(animation)))
horse:runAction(cc.MoveBy:create(6,600)))
原文链接:https://www.f2er.com/cocos2dx/340122.html