I need advice

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

I need advice

Postby thientam » Thu Jun 14, 2018 7:29 am

Hello, I'm using box2d to do all my collision testing and correction. What pattern should I be using?

I have a GameWorld() object which contains a box2d World() and keeps members to do with that inside the GameWorld (such as gravity, camera, etc).

I also have a GameObject() which essentially is going to contain a Box2d Body, animations, textures for an object. Then each Object (such as bullet, player, enemy, etc) is going to be a subclass of this. The GameObject() also has an Update() method which gets run per frame from my main Game() class.

I finally have a GameWorldRenderer() which is going to deal with taking each GameObject() inside a GameWorld() and render their textures.

Is this a good way of doing things? I found a flaw in that I'll be looping over my GameObjects() twice per game loop (one to run their Update() methods, then a second time to draw them using GameWorldRenderer().

Is there a solid pattern I can use to fulfil my needs?
Posts: 2
Joined: Thu Jun 14, 2018 7:24 am

Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest