I am playing around with a game program but I ran into a problem I am having a hard time solving. I have everything in the game broken down into classes that handle themselves at the moment
Game Class (handles all functions pertaining to the game)
- Ship Class (handles all funcations and data for the player's ship)
-- Bullet Class (handles all the bullets shot by the player)
-- Shape Class (keeps data associated with the shape and location)
- Enemy Class (handles all functions associated with enemy behavior)
-- Bullet Class (handles the bullets that this enemy has fired)
-- Shape Class (stores data associated with the shape and location)
- Upgrades Class (drops after a kill and carries an upgrade quality)
The game checks collosions through booleans of the class enemy and ship using a point to bounding box collision detection aka
Once that was working well together and I could fly around and shoot the enemies I started to add my upgrades class. When I started to program a second behavior for the class bullet I ran into some problems. I am trying to program a heat seeking bullet which basicly has to find an enemy on the screen and head for its position. I am having problems creating a solution since the Bullet of the ship handles itself and basicly has to reach out of itself and the ship class then into the enemy class to the shape class to find a location of an enemy. Since there are many enemies on the screen at once I am having trouble doing a few things.
if(ship.Collide(pointX, pointY, pointZ))
1) knowing when the bullets current target is dead.
2) knowing where the current target moved this round
3) Basicly keeping track to the current target out of a possibility of 20-30 enemies on the screen and with up to twenty heat seeking bullets on the screen.
I am not having any problems with the code itself so I didn't post it. Any suggestions would be greatly appreciated maybe its a bad idea to let each class handle its own physics?