Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by fulvio

I've noticed that the performance with my platformer game is quite slow on iOS (mostly due to the amount of entities and background layers on my levels). I'm just wondering whether using Box2D would increase or decrease the performance when there's more entities on screen?

What are the advantages when using Box2D other than the physics side of things?

10 years ago by Xatruch

Yea thats the great thing about box2d, its physics. Also you can get creative with the joints it has and make custom shapes. But of course the price is the decrease of performance in the game.

And if you can please avoid this
this.body.ApplyForce(new b2.Vec2(10, 0) ...

Since you're creating a new b2.Vec2 object every fps it creates garbage. You could define it in init:
init: {
this.force = new b2.Vec2(10, 0);
...
}
update: function() {
this.body.ApplyForce(this.force, this.body.GetPosition());
...
}

good luck ;)
Page 1 of 1
« first « previous next › last »