Cocos2d JS HTML5 -


i want rotate image in cocos2d java-script html5. upper , lower circles 2 different sprites. using code:

var rotationamount=0; top=cc.sprite.create("assets/top.png"); top.setposition(midx,midy+100); top.schedule(function(){     if(rotationamount>360)         rotationamount=0; });     this.addchild(top); 

here's how sprites look:

sprites

the above causes sprite starts rotate around itself. want make rotate around point, going wrong?

you can next:

var top = cc.sprite.create("assets/top.png"); var rotateaction = cc.rotateby.create(0, 1);   top.attr({      x: midx,      y: midy,      anchorx: 0.5,      anchory: 0.5  });  top.schedule(function() {   top.runaction(rotateaction); });  this.addchild(top); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -