Scene Management in 2D game
I'm currently working on a 2D space game, and I'm up to the part where I can start developing my scene manager. However, I want to do this in such a fashion I can reuse the manager in later games(Which there will be).
I've discussed this issue with a friend, and came up with this design:
All game objects are derived from a generic CSceneObject base class. So, both PlayerShip and EnemyShip will be derived from this.
During update of the game, I call SceneManager->Update(FrameTime,...) to update all objects and do collision detection. And this is where the problems arise.
For instance, if the collision is with a bonus object the collision is obviously different then when it's with a Plasma Burst shot. I was thinking of doing something along the lines of: pCheckedObject->Collision(pCollisionObject)
This will tell pCheckedObject that is collided with pCollisionObject. And then inside the Collision function(Which is pure virtual in the cOBject class) I can handle the correct reaction to this. So far, so good.
But how on earth am I getting a enum ObjectType into my cObject class? Do I template it, and when creating a new object, I call new cAlienShip<ObjectType>?
I'm kinda confused here...
Toolmaker
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement