void drawcollision_one()
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[3]);
glBegin(GL_POLYGON);
glTexCoord3f(0.0f + screen, 0.0f, 0.0f);
glVertex3f(0.5f, -0.5f, 0.0f);
glTexCoord3f(0.167f + screen, 0.0f, 0.0f);
glVertex3f(0.5f, 0.5f, 0.0f);
glTexCoord3f(0.167f + screen, 1.0f, 0.0f);
glVertex3f(-0.5f, 0.5f, 0.0f);
glTexCoord3f(0.0f + screen, 1.0f, 0.0f);
glVertex3f(-0.5f, -0.5f, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
}
void timer(int val)
{
screen += 0.1667f;
if (screen >= 1.0f)
{
screen = 1.0f;
}
glutPostRedisplay();
glutTimerFunc(500, timer, 0);
}
void coll_plane_one()
{
//draw bullet
float x = 5.0f+horizontal_one;
float y = 0.0f+vertical_one;
float oWidth = 0.125f;
float oHeight = 0.125f;
//draw plane
float xTwo = -5.0f+horizontal+up_two;
float yTwo = 0.0f+vertical;
float oTwoWidth = 1.0f;
float oTwoHeight = 1.0f;
if (checkCollide(x, y, oWidth, oHeight, xTwo, yTwo, oTwoWidth, oTwoHeight) == 1)
{
drawcollision_one();
}
}
I hope it is ok if I go back to my plane game that I started on last year. I am using a collision function to call a collision function but it does not call the collision function properly. when the bullet hits the enemy ship it does not display the collision function.