Quick ? on Game design
First let me tell you generally how I have set everything up. I have created a general grafx class and derived from that my specific needs such as enemies and weapons, ect. Each of my pics is an individual object with ability to move, track, fire, (and soon rotate).
Now my question is how do you guys implement checking for collisions? Such as each individual object checks or a general function which checks all objects?
now if your question is wether to check a the moving object or to check all per turn,
i'd say just check the objects that are moving, otherwise things would get messy and slow.
now if your question is wether or not to use a generl function for all collision or one for each, then the answer is not so simple.
if none of the objects require any special checking or if the sme code will work for all, use one.
if one or several objects require speciality checking use one for each, maybe based off the main one that does the basic check?
Well, this is how I might do it:
Have a function for the base class, which checks if there's a collision. Then declare a pure virtual function (i.e. 'onCollide()') for the base class, and overload it in the derived classes (well, you have to). So when the base collision-detect function detects a collision, it calls the derived class' onCollide() function, which does a specific task. 'course, it would be pretty slow (I heard from someone that inheritance is baaaad), but who cares? :p