Need advice on a timer issue

Get help using Construct 2

Post » Wed May 02, 2012 8:00 pm

Hi, I'm making a 'whack-a-mole' type game for the kids and although I haven't started any of the 'programming' yet I'm a bit puzzled on the best way to time how long a mole has been up, out of the ground.

As you know a random mole is picked and pushed out of the ground. Depending on the level there may be more moles pushed up while that one is up. Each mole will stay up for a period of time before dropping back into the ground.

Can anyone recommend a way to keep track of how long each mole has been up? Setting up a timer for each seems to be a long way of doing things, although it would work (I think). Any advice or ideas are appreciated.

Thanks in advance.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Wed May 02, 2012 8:33 pm

You can use instance variables as the timer.
[code]
Every tick:
-> Add dt to instance variable
[/code]
Each object's instance variable will increase with 1 every seconds, keeping track of how many seconds the object has been on the screen.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu May 03, 2012 10:02 am

I'm not 100% on how DT works. Any chance you could explain a bit more?

Thanks. ;)
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Thu May 03, 2012 12:54 pm

I think this tutorial explains it pretty well:
Delta-time and framerate independence
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Braus, Ethan, supreme676 and 7 guests