Closed GoogleCodeExporter closed 8 years ago
Translating a whole world will indeed be slow...there's now way to optimize
that because you have to visit every single object in the game and do an
operation on it.
A better way is to only move the bicyclist, and just move your "camera" to keep
the cyclist centered. The physics will be more accurate this way too.
By the way, move your cyclist by applyForce(), not by translating.
Original comment by doug...@gmail.com
on 16 Aug 2011 at 4:39
Thanks. The cyclist is qb2Group which containcs two qb2CircleShapes and I'm
applying applyTorque() onto them. He's moving nicely but of course he always
gets off the stage :) Please is there any tutorial/demo of camera movement? I
saw the qb2DemoReel but it's unclear there :/ Thanks
Original comment by miroslav...@marmar.sk
on 16 Aug 2011 at 4:46
Ah, yea, applyTorque is a better idea :)
The car driving demo in qb2DemoReel follows the screen, but I understand that
it's a little complicated. I intend to make simpler demos, but haven't done so
yet.
The basic idea is that whenever your cyclist moves forward, the
DisplayObjectContainer containing your world should move backwards...something
like this:
worldContainer.x = -cyclist.x + stageWidth/2;
Original comment by doug...@gmail.com
on 17 Aug 2011 at 2:39
Thank you! I've tried it and it works like a charm! ;)
Original comment by miroslav...@marmar.sk
on 17 Aug 2011 at 7:33
Original issue reported on code.google.com by
miroslav...@marmar.sk
on 16 Aug 2011 at 2:00