I have got a tank sprite to rotate left and right but I want it to move up and down and left and right. here is the code I am working on.
void tankmove()
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
if (direction[1] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[1]);
direction[1] = 0;
}
if (direction[2] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[2]);
direction[2] = 0;
}
if (direction[3] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[3]);
direction[3] = 0;
}
if (direction[4] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[0]);
direction[4] = 0;
}
if (direction_two[1] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[3]);
direction_two[1] = 0;
}
if (direction_two[2] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[2]);
direction_two[2] = 0;
}
if (direction_two[3] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[1]);
direction_two[3] = 0;
}
if (direction_two[4] == 1)
{
glBindTexture(GL_TEXTURE_2D, texture[0]);
direction_two[4] = 0;
}
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2f(5.0f, 5.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex2f(-5.0f, 5.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex2f(-5.0f, -5.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex2f(5.0f, -5.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
}