Archived

This topic is now archived and is closed to further replies.

fried_chicken

My first game! Source code included

Recommended Posts

This is my first OpenGL game! Its not that great, but its a start. Its called Tanks! Ive included the source code. You can download it here (around 300kb) http://www.geocities.com/sumguy942/tanks.zip The idea is simple. Set the number of lives at the title screen. The first player to loose that many lives looses the game. The red crosses are health. The green boxes are missles. Dont touch Bill Gates! If you do, your tank will lock up giving the opposing player time to push you off the edge of the arena. Here are the controls Player1: Left, right, up, down................. Move the tank Spacebar ............................... Shoot gun ''M''............................................. Fire missle Player2: ''S'',''X'',''Z'',''C''..............................Move the tank Shift..........................................Shoot gun Ctrl............................................Fire missle Other keys 1-9 changes music. 0 turns music off F1 toggles fullscreen mode Escape will end the game Give me your oppinion! Also tell me how it ran on your computer.

Share this post


Link to post
Share on other sites
Oops! I used the SDL_mixer to play midi music. Since the SDL mixer was a seperate download and I didnt include the main part of SDL with my program, I didnt think I would need SDL.DLL! I uploaded it. Here is the link:

http://www.geocities.com/sumguy942/SDL.zip

Share this post


Link to post
Share on other sites
I cant play it ether becuase i get too high of a frame rate. Everythign mvoes to fast.

It may be a good idea to look into time based movement, as opposed to framebased.

Also i noticed the terrain of the top player would cover the lower players screen.

Share this post


Link to post
Share on other sites
looks like it could be quite fun except that the bullets shot with spacebar are reaaally buggy... they kinda fire off in random directions alot of the time, specially if you don''t hold spacebar down.

Share this post


Link to post
Share on other sites
CRAP! I guess I wasnt thinking straight. Im not completely sure how to do time based movement. Did nehe write a tut on it? Isnt it something like

//Based on Nehe''s framework

void Update(float milliseconds)
{
tank_speed = milliseconds/15;
}

Would that make it run the same speed on all comps?

Sorry if I sound like an idiot... I told you this IS my first gl game!

Ill fix it!

Share this post


Link to post
Share on other sites
Update positions based on velocity * timedifference where timedifference is in fractions of a second and velocity is in units per second. Check the msdn for QueryPerformanceCounter and QueryPerformanceFrequency for a nice timer.

Share this post


Link to post
Share on other sites
well, it runs fine on my machine... have you fixed it, or am I to understand that I have a really slow computer??:_(

Anyways, I just wanted to suggest, you change the speed of missiles, because as it is now, you can outrun your own missile... maybe just add the speed of the tank (when moving) to the missiles speed... it should be fairly easy.

Share this post


Link to post
Share on other sites
if i am not mistaken, you should add the velocity of the tank to the projectile not the speed. if the tank was driving and fired at 90 degrees the projectile would fire faster than usual and go straight, which isn't correct. try it, fling your laptop out the car window at 90 miles per hour

[edited by - bslayerw on July 29, 2003 1:08:53 PM]

Share this post


Link to post
Share on other sites
no thank you I think I will keep my labtop far away from you!!!!

LOL, but your right, I should have said, 'velocity' instead of 'speed' (forgive me I'm a stupid Dane) but you knew what I meant, anyways

Another thing is, I just realised the missile still needs to be faster on its own... I would still be able to fire the missile at an angle, then turn the tank and catch up with my missile... that just wont do!


[edited by - norleaf on July 29, 2003 6:33:42 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi
I just wanted to say that your game is nice, but I agree with the person saying that the missles should faster.
Nice game again.
Bye

Share this post


Link to post
Share on other sites