How do I reset the time?

Get help using Construct 2

Post » Sun Nov 25, 2012 10:14 pm

So here's my issue, I have a game in which an event occurs every ten seconds and when the player dies it resets the layout. Now the every ten seconds is related to a variable (distance) and I need them to line up. Evidently resetting all global variables does not include the system expression time. So how do I reset the time so that every ten seconds is based of the start of the layout being 0?

TLDR; I need my every 10 seconds event to be based off the the beginning of the layout.
B
72
S
24
G
11
Posts: 452
Reputation: 12,385

Post » Sat Dec 01, 2012 5:55 pm

Bump
B
72
S
24
G
11
Posts: 452
Reputation: 12,385

Post » Sat Dec 01, 2012 6:44 pm

hello
one way around it is to do every 0.01 seconds + 0.016666 to a global variable
then in divide it by ten for the no. of ten seconds.
on "player" destroy reset global variables

cons : the decimal values showing up.
       there is a minor miscalculations of 0.1 seconds
       it is a sort of cheating
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Sat Dec 01, 2012 7:02 pm

[quote=Draspur]How do I reset the time?[/quote]

With quantum physic.
Or a counter.

Make a global variable "TimeCount", set it to 0.

Add an event:
  • "TimeCount" >= 0 => action Add dt to "TimeCount".


  • Add another event:
  • "TimeCount" >= 10 => action Set "TimeCount" to 0 + anything else you want to happen after 10 seconds
  • .
    This allows you to "reset time" by setting the value of "TimeCount" to 0.
    New to Construct ? Where to start

    Image Image

    Image Image

    Please attach a capx to any help request or bug report !
    Moderator
    B
    294
    S
    117
    G
    96
    Posts: 7,313
    Reputation: 71,094

    Post » Sat Dec 15, 2012 6:19 am

    [QUOTE=Kyatric] [quote=Draspur]How do I reset the time?[/quote]

    With quantum physic.
    Or a counter.

    Make a global variable "TimeCount", set it to 0.

    Add an event:
  • "TimeCount" >= 0 => action Add dt to "TimeCount".


  • Add another event:
  • "TimeCount" >= 10 => action Set "TimeCount" to 0 + anything else you want to happen after 10 seconds
  • .
    This allows you to "reset time" by setting the value of "TimeCount" to 0.[/QUOTE]

    Thanks, worked great!
    B
    72
    S
    24
    G
    11
    Posts: 452
    Reputation: 12,385


    Return to How do I....?

    Who is online

    Users browsing this forum: No registered users and 24 guests