I’m stuck trying to create a framework for my game objects’ collision reaction in a flexible way…
Assuming collision detection is already found, I’m now left with two objects which need to affect each other. Currently i’ve got 4 main catergories of object: Player, AI, Projectile & Powerup. All have a common base class for shared functionality.
Now what? Ideally, i’d like to be able to write a new class, such as a Grenade, which would be of type Projectile, and not have to alter any other classes. Yet all existing classes should interact with the new class properly. In short, adding a new weapon/enemy/powerup should be a single drop-in class.
So far I’ve realised I probably need some sort of priority system for determining which of the two objects takes responsibility of the collision, but beyond that i’m out of ideas. Anyone got any good advice on the subject?