My first game! Source code included
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.
When your on a battlefield, dont throw a grenade. Throw a bannana instead. While the opposing side is pondering the meaning of this, blast their heads off with the nearest available weapon.
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
http://www.geocities.com/sumguy942/SDL.zip
When your on a battlefield, dont throw a grenade. Throw a bannana instead. While the opposing side is pondering the meaning of this, blast their heads off with the nearest available weapon.
Looks good... unfortunately I can''t play it because I get about 1300-2500 fps. I suggest adding timer code so that the game runs independent of framerate

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.
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.
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.
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!
//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!
When your on a battlefield, dont throw a grenade. Throw a bannana instead. While the opposing side is pondering the meaning of this, blast their heads off with the nearest available weapon.
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.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
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.
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.
--------------------------------------------------------------What's the problem? I don't got a problem, I got fuckin' problems! plurum!-Tim Roth, Four Rooms
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]

[edited by - bslayerw on July 29, 2003 1:08:53 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement