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
48
S
18
G
7
Posts: 429
Reputation: 8,859

Post » Sat Dec 01, 2012 5:55 pm

Bump
B
48
S
18
G
7
Posts: 429
Reputation: 8,859

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
    247
    S
    85
    G
    40
    Posts: 6,998
    Reputation: 57,786

    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
    48
    S
    18
    G
    7
    Posts: 429
    Reputation: 8,859


    Return to How do I....?

    Who is online

    Users browsing this forum: badmoodtaylor and 12 guests