well I am able to get my sprites to rotate and move in all directions, I have drawn two plane sprites, I am also able to shoot a bullet in the up direction, I want to shoot bullets in all directions just like my plane rotates, I just need a hint on how to proceed, go easy on me this is new stuff to me. However I am making progress.
shooting bullets
I found this tutorial helpful.
http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-1/
cool I am actually taking a college course in linear algebra and I have already studied some linear algebra this summer, I am unsure of how to apply this math to my game, thanks for the link. I will also study this tutorial.
well I have studied the tutorial and some youtube videos about linear algebra
It helps if post questions instead of statements, as I cannot given an answer to the latter.
Anyway, assuming your plane has an direction of flight and a position, you can use those to compute the path where the bullet should fly.
should I use the glRotatef function to rotate the bullet around the plane sprite or should I use the sin and cos functions.
For my space game I created bullets and gave them the same position, rotation and velocity (maybe acceleration also) as the ship and then gave them acceleration in the forward pointing vector of the ship.
Then you can use the same method to draw the bullets as you do the ship.
🙂🙂🙂🙂🙂<←The tone posse, ready for action.
glPushMatrix();
glTranslatef(-4.5f, 0.5625f,0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glTranslatef(4.5f, -0.5625f, 0.0f);
glBegin(GL_POLYGON);
glTexCoord3f(0.0f, 0.0f, 0.0f);
glVertex3f(-4.4375f, 0.625f+up+vertical, 0.0f);
glTexCoord3f(1.0f, 0.0f, 0.0f);
glVertex3f(-4.4375f, 0.5f+up+vertical, 0.0f);
glTexCoord3f(1.0f, 1.0f, 0.0f);
glVertex3f(-4.5625f, 0.5f+up+vertical, 0.0f);
glTexCoord3f(0.0f, 1.0f, 0.0f);
glVertex3f(-4.5625f, 0.625f+up+vertical, 0.0f);
glEnd();
glPopMatrix();
I am trying to draw a bullet down but it can only draw an up bullet