该函数只适用于cocos2dx 2.2.5
--创建帧动画 --[[ FrameWidth 帧动画宽 FrameHeight 帧动画高 imageFile 图片文件 默认循环播放 ]]-- local function createAnim(FrameWidth,FrameHeight,imageFile) local tex = CCTextureCache:sharedTextureCache():addImage(imageFile) frame0 = CCSpriteFrame:createWithTexture(tex,CCRectMake(0,FrameWidth,FrameHeight)) frame1 = CCSpriteFrame:createWithTexture(tex,CCRectMake(FrameWidth*1,FrameHeight)) local spriteDog = CCSprite:createWithSpriteFrame(frame0) spriteDog:setPosition(CCPoint(100,100)) spriteDog:setVisible(true) animFrames = CCArray:createWithCapacity(2); animFrames:addObject(frame0); animFrames:addObject(frame1); animation = CCAnimation:createWithSpriteFrames(animFrames,0.5) animate = CCAnimate:create(animation); spriteDog:runAction(CCRepeatForever:create(animate)) return spriteDog end