It would appear that I was rated down since then, so I still might have a good chance to get it back...
Anyways, I've added temporary invincibility after taking hits in the game. Already the game is alot more fair. However, I was forced to go back and raise some hard-coded damage levels to at least make the game difficult.
Next I'm going to try and make the homing missle weapon. This was probably the toughest of my goals, which is why I wanted to take care of it now.
So why is this so tough? Well, it's simply because the way my code is organized.
However, one of the problems has nothing to do with that. The first problem I thought of is how would I rotate the missle? My first thought was to use SDL_gfx and then use the rotozoom library. However, I realized that this would be an overkill, because the missle would only travel in 8 different directions: north, south, east, west, northeast, northwest, southeast, southwest. So I decided to just draw 8 different missle sprites given the missles orientation. So with that problem solved, I thought about how to implement the weapon more...
Now here comes the biggest problem, finding out what to actually lock onto. Now if this wasn't bad enough, the way I wrote the code makes it worse. Alot of the classes in the code don't "know" that some other classes exist. For instance, the weapon class is used by the player class, but the weapon class doesn't know of the existance of the player class. The same is true with player and enemy. So how would I even tell the missle what to lock onto?
This seemed quite hopeless, but than I realized that all weapons are stored as global variables. When a player uses a weapon, it obtains a pointer to that global weapon object. So I can write my enemy code so that it passes the missle launcher object a list of coordinates that it can lock onto.
One more problem remains. Suppose your using the missle launcher, and you jump over an enemy and then try to shoot an enemy in front of you. If I were to write the weapon as I've explained so far, the missle wouldn't aim for the enemy in front, but would indeed, lock-on to the enemy in back. Worse yet, it could try to hit an enemy that is offscreen. This is simple though, just give the player a certain range of which the weapon can lock on.
I haven't tried out any of these solutions yet, so they might not even work. But, I'll give it a good try and attempt to get this weapon working.