Frist off the textures look nice… once you get it going will be a nice looking game.
I think you that one problem is with using glLoadIdentity() for drawing each object.
But after looking closer at your program it also could be that your using perspective view. Perspective view is for drawing 3D real world view of object. as they move away on the Z axis they get smaller.
Your plane is at -32, your bullet is at -100.
Think about your at one end of a football field and looking down at two players. One player is at your end, the other is at the other end. Even though they maybe on the same spot at each end of the field, one will look like he is closer in to the center.
Two solutions to your problem, one is to move the bullet to the same z as the plane.
Other would be to switch from perspective view to ortho view.
In ortho view, objects look the same no matter where they are on the Z-axis.
Also try this:
glPushMatrix(); Replace all other glLoadIdentity with this
glPopMatrix(); // end of first object
for(register short i = 0; i < ENEMIES; i++)
Enemy[i].Ypos -= Enemy[i].Speed;
for(register short j = 0; j < BULLETS; j++)
if (Bullet[j].Ypos > 40.0f)
Bullet[j].Active = false;
Bullet[j].Ypos += 0.50f;
Hope this helps… keep us posted on your progress…
Originally posted by -Tony-:
[b]Hi, I’m trying to make top-down shooter game with C/SDL/OpenGL
The problem is that when you shoot, the bullets don’t come from the plane but from somewhere from the middle of the screen or near the plane.
The planes Xpos,Ypos are the same as the bullets when you fire it so I don’t understand why this happens.
Here’s the source: http://w1.853.telia.com/~u85324201/main.htm http://w1.853.telia.com/~u85324201/texture.h.htm
I’ve posted this in many other forums but nobody knew the solution…
Could somebody help?[/b]
[This message has been edited by nexusone (edited 09-15-2002).]