Reset Time

Get help using Construct 2

Post » Thu Jan 03, 2013 11:19 pm

I've got events which spawn an object at a random time, this makes use of time scale.

I've got a problem, I need to reset the time to 0 on when the player dies. For example, the player dies 10 seconds into the game, I click restart or menu button that pops up on screen, I need it to reset the time that has passed to 0.

You can restart the layout or reset global variables, which is no problem but there doesn't seem to be an easy way to set global time to 0.

I was wondering if anyone had a solution.

Thanks for reading :)Toby122013-01-03 23:50:50
B
11
S
2
Posts: 43
Reputation: 1,411

Post » Thu Jan 03, 2013 11:49 pm

The time scale is used to slow down or speed up the game time, so I assume you're talking about the game time itself, the number you get by using the 'time' expression? You cannot reset the game time, instead, create your own variable (call it something like 'timer') and just add 1 to it every second. (or even better, add 'dt' to it every tick)

Edit: If you want to use time scale, you have to do it with delta-time (dt)Nimtrix2013-01-03 23:52:46
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jan 03, 2013 11:54 pm

Yeah, sorry I've just tried to clarify that :).

The problem is, the random spawner i'm using makes use of the time expression. I did use a variable originally, but couldn't couldn't see how I'd implement a random spawner if I used one.

Here's a link to the capx. https://dl.dropbox.com/u/17611007/create%20at%20random%20period.capx

It was made by someone else on the forum (the name slips me at this moment).

EDIT: Maybe it'll work if I set the current time to an integer of the variable. Will try that now :)

EDIT2: Looking good at the moment. Think that may have solved it. Thanks for the help :) :)Toby122013-01-04 00:03:30
B
11
S
2
Posts: 43
Reputation: 1,411

Post » Sat Nov 07, 2015 4:08 pm

HI toby,

I have got the same issue and i was looking to reset my timer..could you help me out on this..
B
3
Posts: 4
Reputation: 183

Post » Sat Dec 19, 2015 11:07 pm

Wish we could reset the time... although I suspect there is some kind of internal game engine issue that would arise if we could, so I guess the variable trick will have to do.
Image
B
16
S
3
G
1
Posts: 18
Reputation: 1,375


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, randomly, Yahoo [Bot] and 25 guests