# glut game

• (6 Pages)
• « First
• 4
• 5
• 6

## 77 Replies - 5331 Views - Last Post: 19 August 2018 - 08:27 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=409011&amp;s=5d426273cce4d5045b6dd8e86fbcda47&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #76 pbivens85

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

## Re: glut game

Posted 13 August 2018 - 04:18 PM

I think my problem is that I don't have an excellent understanding of the glutTimerFunc function, I will do some research on this topic.

### #77 pbivens85

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

## Re: glut game

Posted 19 August 2018 - 06:34 PM

well I have asked this question before but never got a clear answer. I am working on a 1945 plane game. I have got a bullet to hit a plane and then draw collision sprite but then it redraws the plane sprite again. I want it to black out the plane sprite after the collision sprite is drawn for a brief period of time. I am using the sleep function to make a small delay. here is the code I am working on.
```void collision(int value)
{
//	flag[0][0] = 1;
glutTimerFunc(1000, collision, 5);
}

void coll_plane_one()
{
float x = -0.5f + scroll;
float y = -8.0f + up;
float oWidth = 0.5f;
float oHeight = 0.5f;

float xTwo = -7.5f;
float yTwo = 9.0f + down;
float oTwoWidth = 1.0f;
float oTwoHeight = 1.5f;

if (checkCollide(x, y, oWidth, oHeight, xTwo, yTwo, oTwoWidth, oTwoHeight) == 1)
{
drawScene_collision_one(-7.5f, 10.0f);
Sleep(50);
glutTimerFunc(25, collision, 5);
}
}

void erase_sprite()
{
if (flag[0][0] == 1)
{
glColor3f(0.0f, 0.0f, 0.0f);
glBegin(GL_POLYGON);
glVertex3f(-7.5f, 10.0f+down, 0.0f);
glVertex3f(-7.5f, 9.0f+down, 0.0f);
glVertex3f(-6.5f, 9.0f+down, 0.0f);
glVertex3f(-6.5f, 10.0f+down, 0.0f);
glEnd();
}
}

void drawScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
bullet();
drawScene_plane_two();
coll_plane_one();
erase_sprite();
drawScene_plane_one();
glutSwapBuffers();
}

```

### #78 modi123_1

• Suitor #2

Reputation: 15493
• Posts: 62,050
• Joined: 12-June 08

## Re: glut game

Posted 19 August 2018 - 08:27 PM

Start a new thread. This has been six pages of who-knows-what, endless bumps, and what evers.