图片帧动画-Quick-Cocos2dx
发布时间:2020-12-14 16:56:06 所属栏目:百科 来源:网络整理
导读:图片帧动画 效果如下: -- 图片帧动画 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
图片帧动画 -- 图片帧动画
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)))
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |