Question

I started a 2D top down game with libgdx scene2d and i like how it is implemented, its logic and how the programmers can use it (for example stage.act() calls actor.act(delta) for every registred Actor). Now i thoguht about using this logic for a 3D game. I know that scene2d is mainly made for UI and not for games at all, especially not for 3D. But my 3D games logic would be like 2D top down. Let me explain: You, the player, are in a maze. You can only collide with the walls, which are the same on every height. So the collision detection would be the same as in 2D top down. Also you cannot jump, only walk forward, backward... so also movement would be the same as 2D topdown. Only the view, so the drawing, would be first person, so 3D. Would it be to bad to abuse scene2d for the logic only and use Model and so on for the 3D drawing? I just thought using scene2d, so i don't have to write my own "all registered objects act now" methods. What do you think about it?

Was it helpful?

Solution

You could use scene2d in this case, if you want to catch input events on your Actors, for example mouse clicks.

That's actually one of the main uses for scene2d (and why it's used mostly for UI). Another reason is the ability to group actors, but I think you wouldn't need that.

If you do not want to catch input events on your game objects, then you should not use scene2d.

Simulating what scene2d's Stage does is as easy as maintaining a List<Entity> and calling entity.update(delta) (equivalent to stage.act()) and entity.render(delta) (equivalent to stage.draw()) on each entity in the list.

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