In my game a objects (bodies) move each frame and it does not matter I use Box2D or Nape.
//for example
var body:Body = createNewBall();
addChild( body.graphic );
addEventListener( Event.ENTER_FRAME, loop);
private function loop():void {
space.step(1/30, 10, 10);
}
But Starling use animation with jugglers. Perhaps it somehow affects performance.
var body:Body = createNewBall();
addChild( body.graphic );
var tween:Tween = new Tween(body.graphic, 2);
tween.animate("x", glX);
tween.animate("y", glY);
Starling.juggler.add(tween);
But how to use the jugglers in case enter_frame animation?
When using a physics engine usually you won’t animate your objects by regular
Tweenadded to the starling juggler, but instead you just update the position of the graphic object according to the positon calculated by the engine on each step. You are going to need to use anENTER_FRAMEso you can make the engine advance each step. Using your posted code, you could do something like:There is a great tutorial on gotoandlearn.com about using Starling and Nape that covers this, and all the basics you’ll need to get started. Hope this helps!