Updating sprite position as the world changes
Unfortunately, our totem is still just a bunch of static sprites. Yes, we attached them to a body, but what happens when the world changes?
Try to remove the left foot of the totem, this way:
init:function () { this._super(); var backgroundLayer = cc.LayerGradient.create(cc.color(0xdf,0x9f,0x83,255), cc.color(0xfa,0xf7,0x9f,255)); this.addChild(backgroundLayer); var gravity = new Box2D.Common.Math.b2Vec2(0, -10) world = new Box2D.Dynamics.b2World(gravity, true); this.scheduleUpdate(); this.addBody(240,10,480,20,false,"assets/ground.png","ground"); //this.addBody(204,32,24,24,true,"assets/brick1x1.png", "destroyable"); this.addBody(276,32,24,24,true,"assets/brick1x1.png","destroyable"); this.addBody(240,56,96,24,true,"assets/brick4x1.png","destroyable"); this.addBody(240,80,48,24,true,"assets/brick2x1.png","solid"); this.addBody(228,104,72,24,true,"assets/brick3x1.png","destroyable"); this.addBody(240,140,96,48,true...