Plane game project

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.

void drawcollision_one()

	glBindTexture(GL_TEXTURE_2D, texture[3]);

	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);


void timer(int val)
	screen += 0.1667f;
	if (screen >= 1.0f)
		screen = 1.0f;
	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)

This isn’t an OpenGL question.

Consider doing more reading on computing collisions. Should you decide to post someplace (like which includes discussion of collision detection techniques, you should post relevant code. For instance, you say that your collision function isn’t called properly, yet you show no code in your example which could even potentially call it.

Another related thread on this, presumably:

1 Like