码迷,mamicode.com
首页 > 其他好文 > 详细

quick cocos animate

时间:2015-03-03 01:08:17      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:

spriteEx.lua

function Sprite:playAnimationOnce(animation, removeWhenFinished, onComplete, delay)
    return transition.playAnimationOnce(self, animation, removeWhenFinished, onComplete, delay)
end

function Sprite:playAnimationForever(animation, delay)
    return transition.playAnimationForever(self, animation, delay)
end
local MainScene = class("MainScene", function()
    return display.newScene("MainScene")
end)


function MainScene:ctor()
    local sp=display.newSprite("1.png",200 ,200);
    self:add(sp)
    
    local animation=cc.Animation:create()
    animation:addSpriteFrameWithFile("1.png")
    animation:addSpriteFrameWithFile("2.png")
    animation:setDelayPerUnit(1)
    sp:playAnimationForever(animation,1)
    sp:playAnimationOnce(animation, removeWhenFinished, onComplete, delay)
end



return MainScene

 

quick cocos animate

标签:

原文地址:http://www.cnblogs.com/yufenghou/p/4310044.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!