PDA

Click to See Complete Forum and Search --> : C++: Space Invaders [Source]


Electroman
Jun 8th, 2004, 03:20 PM
Here is a same game I made for Uni. I wouldn't say its totally finished but it is good enough to play.

Don't be afraid of getting shot, the player doesn't die but will get injured. I haven't yet done anything that will make you proper dead if you get to damagd though. The player does regenerate if you do get shot. There is also modelling that means depending where you get shot the effect will be diferent ;).

Ow well, Enjoy :D:D.
The Source is in VC++6 ;). The Graphics Engine isn't mine, I am working on my own that will be in VC++.NET and more optimised though ;).

BTW the exe is included incase you don't have a C++ compiler ;).

EDIT: Updated the file.

SLH
Jun 8th, 2004, 04:03 PM
It ran way too fast on my computer, guess you altered the game loop just before zipping up the project or something.....

From what i could see it looks good though. :)

Electroman
Jun 8th, 2004, 04:05 PM
Strange, the Timer code is actually part of the engine that the lecturer made. Its meant to use the performance counter thing to make each frame 20ms :confused:, will check it out though. :D

Electroman
Jun 8th, 2004, 04:11 PM
Try setting a break point on the line I highlighted and see if it gets run. If it does then it would explain it:
GameTimer::GameTimer()
{
if(QueryPerformanceFrequency(&freq)==0) // Find the timer frequency
{
freq.QuadPart=0; // Set to zero if function failed
}

mdGameRate = 1.0;
}

This code is in the gametimer.cpp ;).

SLH
Jun 8th, 2004, 04:15 PM
Nope. Doesn't get ran.

EDIT: Just noticed, it's doesn't run fast ALL the time, very occasionally it'll slow down to roughly normal for about half a second. Very strange..... :confused:

Electroman
Jun 8th, 2004, 04:26 PM
yea I feel a bit silly now, I just checked and the timer isn't used at all :(. I'm sure it used to be. I'll try and add it in now....

Electroman
Jun 8th, 2004, 05:02 PM
There we go, I fixed it, the Timer code weren't half messed up too, I had to edit it quite a bit to get it to work. I acidently set the delay to 20 when testing it, not realising it was in seconds, took me ages to get out of the game :(.

wiccaan
Mar 29th, 2005, 02:26 PM
Heh fun little game, cool addon too when you get hit you slow down and cant move for a sec. But yea, runs fast on my computer a little.