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); sprite.runAction(cc.repeatForever(action)); }
再次特别鸣谢张翼翔老师(或者是个资深Leader或者攻城狮)的教程,特别清晰明了,比cocos2d官网上的强太多了。