1 Replies - 1349 Views - Last Post: 06 May 2014 - 08:28 PM Rate Topic: -----

#1 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

bug wars

Posted 03 May 2014 - 08:32 PM

well I need help with my collision detection routine. I can get the collision sprite to overdraw the bug sprite when it gets hit my the bullet sprite. But after the bullet sprite leaves the bug sprite area the bug sprite is drawn over again and the bullet continues going up the screen. I also need the collision sprite to be erased when the bug sprite .area is used and no longer needed. Here is the code I am using.
void drawScene_two()
{
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, _textureId_eight);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

	glColor3f(1.0f, 1.0f, 1.0f);
	glBegin(GL_POLYGON);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(-0.5f, 1.0f, 0.0f);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(-0.5f, 2.0f, 0.0f);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(0.5f, 2.0f, 0.0f);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(0.5f, 1.0f, 0.0f);
	glEnd();

	glDisable(GL_TEXTURE_2D);
}

void collision()
{
	sprite object1;
	sprite object2;

	object1.x = -0.5f+scroll;
	object1.y = 2.0f - down;
	object1.width = 1.0f+scroll;
	object1.height = 1.0f;

	object2.x = -0.25f+scroll;
	object2.y = -7.5f + up;
	object2.width = 0.50f+scroll;
	object2.height = 0.50f;

	if (Sprite_Collide(&object1, &object2) == 1)
	{
		drawScene_two();
	}
}



Is This A Good Question/Topic? 0
  • +

Replies To: bug wars

#2 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: bug wars

Posted 06 May 2014 - 08:28 PM

what am I doing wrong? what can I do to get some feedback on my question?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1