OnWalkClick:function(sender){ var sfLaoJun1=new cc.SpriteFrame(res.npc_laojun1,cc.rect(0,0,70,101)); var sfLaoJun2=new cc.SpriteFrame(res.npc_laojun2,cc.rect(0,0,70,101)); var sfLaoJun3=new cc.SpriteFrame(res.npc_laojun3,cc.rect(0,0,70,101)); var sfLaoJun4=new cc.SpriteFrame(res.npc_laojun4,cc.rect(0,0,70,101)); var sfLaoJunAll=new Array(sfLaoJun1,sfLaoJun2,sfLaoJun3,sfLaoJun4); var amnLaoJun=new cc.Animation(sfLaoJunAll,0.05); var action=cc.animate(amnLaoJun); var sprite=new cc.Sprite(); sprite.setPosition(160,300); this.addChild(sprite); cc.animationCache.addAnimation(amnLaoJun,"LaoJun"); sprite.runAction(cc.repeatForever(action)); }, OnSpriteFrameCacheTesting: function (sender) { var amnLaoJun=cc.animationCache.getAnimation("LaoJun"); var amtLaoJun=new cc.Animate(amnLaoJun); var sprite=new cc.Sprite(); sprite.setPosition(160,400); this.addChild(sprite); sprite.runAction(cc.repeatForever(amtLaoJun)); }
依然感谢张翼翔先生。
时间: 2024-12-04 20:12:59