图片帧动画-Quick-Cocos2dx

前端之家收集整理的这篇文章主要介绍了图片帧动画-Quick-Cocos2dx前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

图片帧动画
效果如下:

  1. -- 图片帧动画
  2. local frames = {
  3. 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))
  4. }
  5.  
  6. local horse = cc.Sprite:createWithSpriteFrame(frames[1])
  7. self:addChild(horse)
  8. horse:setPosition(200,200)
  9.  
  10. local animation = cc.Animation:create()
  11. animation:setDelayPerUnit(0.1)
  12. for i,frame in pairs(frames)do
  13. animation:addSpriteFrame(frame)
  14. end
  15.  
  16. horse:runAction(cc.RepeatForever:create(cc.Animate:create(animation)))
  17. horse:runAction(cc.MoveBy:create(6,600)))

猜你在找的Cocos2d-x相关文章