# 1945 game

• (4 Pages)
• 1
• 2
• 3
• 4

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

### #31 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 25 August 2018 - 02:37 PM

One way is to start a clock variable. When you want the event to start get the current time, add how ever many units of time you want, and stash that in a variable. This would be the 'future' time you want things to stop at.

As the engine rolls over have an IF statement check if the current time is greater than or equal to that variable time... when it does do what ever... like kick off another animation.. clear variables.. etc.

### #32 pbivens85

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

## Re: 1945 game

Posted 26 August 2018 - 02:24 PM

well I have coded up according to post #31, am I on the right track?
```void wait()
{
clock_t start_time = clock();
int time = 10;
if (start_time >= time)
{
drawScene_collision_one(-7.5f, 10.0f);
}
}

```

### #33 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 26 August 2018 - 05:23 PM

Does it run? Does it do what you intend? I'm not keen on doing what you could accomplish by a basic build/run command.

### #34 pbivens85

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

## Re: 1945 game

Posted 26 August 2018 - 06:04 PM

well it does run but it does not do what I want it to do. I still want it to draw the collision sprite then black out the sprite. it simply blacks out the sprite.

### #35 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 12680
• Posts: 45,864
• Joined: 27-December 08

## Re: 1945 game

Posted 26 August 2018 - 07:29 PM

So it looks like pbivens85 has been battling this issue since December... And again in June.

### #36 pbivens85

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

## Re: 1945 game

Posted 26 August 2018 - 07:38 PM

yes I know, but I really want to solve this problem.

### #37 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 26 August 2018 - 08:58 PM

Then think it out. Heck - a boolean would work.

```IF bullet collides with ship THEN
flip on boolean value
END IF

...

IF boolean is true THEN
draw collision
save the current time plus 2 seconds.
END IF

...

IF boolean true AND current time is greater than the saves time THEN
clear collision
set boolean to false
END IF
```

Honestly, at this point, I would recommend getting over the hump of wanting to do what ever game engine you are writing and use an existing one.

### #38 pbivens85

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

## Re: 1945 game

Posted 27 August 2018 - 02:12 PM

well I am working on this problem for a college class I am taking, that is why I have not abandoned this project.

### #39 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 27 August 2018 - 02:15 PM

... and the class specifically called for you to cobble some GLUT game engine together, or did it ask to just 'create a game'?

Following that - have you even gotten a book on the topic?

### #40 pbivens85

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

## Re: 1945 game

Posted 27 August 2018 - 02:24 PM

my instructor wants me to use glut and to create a space invaders like plane game, I have read several books on opengl and am reading a book on c++.

### #41 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 27 August 2018 - 02:25 PM

Huh.. What books?

### #42 pbivens85

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

## Re: 1945 game

Posted 27 August 2018 - 02:28 PM

I have read opengl superbible and the opengl programming guide

### #43 pbivens85

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

## Re: 1945 game

Posted 27 August 2018 - 04:46 PM

well here is my code for post #37
```void wait()
{
clock_t start_time = clock() + 1;
int time = 10;
cout << start_time << endl;
if (sprite == true)
{
clock_t start_time = clock() + 1;
int time = 10;
drawScene_collision_one(-7.5f, 10.0f);
}
if (sprite == true && start_time > time)
{
erase_sprite();
sprite = false;
}
}

```

is this correct?

### #44 modi123_1

• Suitor #2

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

## Re: 1945 game

Posted 27 August 2018 - 04:58 PM

Again.. Does it work? Does it compile? *You* should be testing it.

### #45 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 12680
• Posts: 45,864
• Joined: 27-December 08

## Re: 1945 game

Posted 27 August 2018 - 05:52 PM

pbivens85, on 27 August 2018 - 05:24 PM, said:

my instructor wants me to use glut and to create a space invaders like plane game

Uh, huh... You mean in the first week of the semester (read- syllabus week, where very little material is covered in class), the professor wants you to build the game you have been working on since May, 2015. And in over three years, you have not made any progress on your issue of collision detection.

At this point, I frankly think you want us to do the work for you. Clearly, you are not even remotely close to a point where you are able to successfully work on games, when you cannot (or perhaps, will not) even test your own code.