ok. I finally got working a game with 2 tanks, movement, etc. Right now its little more than bumper cars. Now I need to add the ability to fire and destroy tanks. For collision detection I utilize a struct pt that holds the x and y component of a corner of the collision area mapped onto a bitmap.
Anyways, I'm not terribly familiar with C++ inheritance, but it java I can do something like make a gameobject object, then extend the class definition in player.java and bullet.java so that in gameobject I can do the following:
(java)
public void checkhit(gameobject other)
{
//code to detect point inside collision area
}
Right now I was thinking of just making a bullet manager class, that has an array of struct bullets that has x,y,dx,dy,onscreen,isdead. With just this I need another series of structs that stores the points for the collision area of each bullet. (the stock image is going to be copied and several rotated versions are going to be stored in memory). How the game functions is all of the pics are stored in the main as they are pointers, and each time it redraws the canvas its gonna look for a live bullet and if its live it will paint a pic of the properly angled bullet to point x,y. But now I need to figure out how I'll handle collisions. The tanks already have a public struct collision angles.
I was thinking I could use that or make a separate header with a saved struct and use that as my generic data type.
As for inheritance, you'll have to look into virtual functions.
Also, I don't understand why collision is so much trouble. If you write a gameobject class and derive tank and bullet classes from it, you shouldn't need to treat bullets in any special way.