Results 1 to 2 of 2

Thread: bug wars

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jan 2013
    Posts
    170

    Cool bug wars

    well I have drawn a space ship and bullet and bug sprites to the screen. the one thing I am stuck on is that I want to draw a collision sprite to the screen when a bullet sprite hits a bug sprite and then draws a black sprite to the screen or erases the sprite just hit by a bullet. let me know if you need further explanation of my problem. in the meantime I will continue to work on my problem. thanks in advance for all the help. here is the code I am working with.
    Code :
    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 drawScene_three()
    {
    	glEnable(GL_TEXTURE_2D);
    	glBindTexture(GL_TEXTURE_2D, _textureId_nine);
     
    	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;
    	object1.y = 2.0f;
    	object1.width = 1.0f;
    	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();
    	}
    }
     
    void collision_two()
    {
    	sprite object3;
    	sprite object4;
     
    	object3.x = -0.5f;
    	object3.y = 2.0f;
    	object3.width = 1.0f;
    	object3.height = 1.0f;
     
    	object4.x = -0.25f + scroll;
    	object4.y = -7.5f + up;
    	object4.width = 0.50f + scroll;
    	object4.height = 0.50f;
     
    	if (Sprite_Collide(&object3, &object4) == 1)
    	{
    		drawScene_three();
    	}
    }
    I have tried several things but so far no luck. I have also tried combining the collision detection function into one routine and the drawing routine into one function too.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2013
    Posts
    170
    can I please get some feedback on my problem.

Similar Threads

  1. space wars
    By pbivens in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-23-2014, 10:13 PM
  2. Enemy Territory: Quake Wars error
    By Athen_Rahl in forum OpenGL: User Software
    Replies: 6
    Last Post: 11-09-2009, 10:27 AM
  3. star wars jedi help
    By moebius19 in forum OpenGL: User Software
    Replies: 1
    Last Post: 12-04-2004, 09:02 AM
  4. Problem with Star Wars KOTOR!Help!
    By gven7420 in forum OpenGL: User Software
    Replies: 1
    Last Post: 03-03-2004, 01:57 PM
  5. Star Wars KOTOR White Texture OpenGL
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 01-03-2004, 04:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean