创建动画
init:function(){ this._super(); //create sprite sheet cc.spriteFrameCache.addSpriteFrames(res.running_pList); this.Spritesheet = new cc.SpriteBatchNode(res.runner_png); this.addChild(this.Spritesheet); //init runningAction var animFrames = []; for(var i=0;i<8;i++){ var str = "runner" + i + ".png"; var frame = cc.spriteFrameCache.getSpriteFrame(str); animFrames.push(frame); } var animation = new cc.Animation(animFrames,0.1); this.runningAction = new cc.RepeatForever(new cc.Animate(animation)); //create the hero sprite this.sprite = new cc.Sprite("#runner0.png"); this.sprite.attr({x:80,y:85}); this.sprite.runAction(this.runningAction); this.addChild(this.sprite); //create the move action //var actionTo = new cc.Moveto(2,cc.p(300,85)); //spriteRunner.runAction(actionTo); //this.addChild(spriteRunner); }总结
以上是内存溢出为你收集整理的cocos2dx-js 动画全部内容,希望文章能够帮你解决cocos2dx-js 动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)