Question

I'm using LibGDX (and subsequently Scene2d) to develop a sidescroller game. I know there's a lot of user interface things built into it (buttons, text fields, labels, tables, etc.), but I was wondering, is it suitable to render my actual 2-dimensional game in Scene2d?

I like the way it handles groups and actors, but I wasn't sure if the built-in collision detection would interfere with my Box2d physics simulation.

Was it helpful?

Solution

I wouldn't use Actors to represent sprites, but rather the Sprite class, as the Actor class is more for receiving input and animating, and most your background will likely be static in a sidescroller.

Collision detection outside your Box2D simulation should be unnecessary I think. The physics engine is there to simulate collision detection and response for you.

OTHER TIPS

It's a matter of taste.

Collision handling should be done by Box2D as it was already pointed out, but you might still use scene2d in combination with a custom "PhysicsActor" to bridge between the user input and the Box2D bodies.

But that's only useful if you really want to be able to click on and interact a lot with your bodies.

On the other hand you might just go with a List of custom Entities which you will update and render yourself. That's the way I preferred so far.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top