C++ Timer?

SO i'm in my first c++ class, and I'm working on a project to develop a very small game.

So far, I have:
A board, with the border as stars.
A character for the player.
Bullets for the player to shoot from their character.
They can use the arrow keys to move, and the space button to shoot.

Now for the hard part.
I made a 'monster' appear on the screen...

Now, what I want to do is to incorporate some sort of timer that will spawn another monster after a certain amount of time.

Also, i got a bit ahead of myself.
I have tried to come up with the function/formula for the collision of the bullet to the monster.

Please note, all of this is being done in Win32 Console App...

Can any of you help me out? I asked my instructor and he told me to ask on Monday (my next day of class) but I really want to get this done and actually learn things. He said something about a c_time?
You could use my timer class from http://www.cplusplus.com/forum/lounge/17053/#msg85706
any edit it to your liking.

You could put it to use like this for example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include "Timer.h"

int main()
{
	std::cout << "This program will spawn a monster every 2 seconds." << std::endl;
	const int maxMonsters = 10;
	int monsterCounter = 0;

	Timer t;
	t.InitGameTime();
	float counter = 0.0f;
	float spawnTime = 2.0f;

	do
	{
		float DT = t.GetDeltaTime();
		counter += DT;
		if( counter > spawnTime )
		{
			counter = 0.0f;
			monsterCounter++;
			std::cout << "Spawned A Monster! Counter = " << monsterCounter << std::endl;
		}

	}while( monsterCounter < maxMonsters );

	return 0;
}
You could also look at some of the stuff in http://www.cplusplus.com/reference/clibrary/ctime/clock/
Thank you. I'm going to play around with these ideas and post what I come up with. Thank you.
Topic archived. No new replies allowed.