How do I go to a new layout, but start with NEW time from 0

0 favourites
  • 5 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • I first created a little game. I set up the game so that after certain amounts of time, specific things would happen. I called this layout page "game". For example, in the game:

    1. After 5 seconds, it will play sound1

    2. After 10 seconds, it will play sound2

    AFTER I set up the 'game' page, I then created the intro/title page... I set it up so that once they are on the title page, they hit a button and it brings them to 'game' page... but once they get there, all of the time is screwed up -- since the game already thinks certain time has already passed (while it was sitting on the title screen). Therefore...

    HOW CAN I SET UP THE GAME SO THAT WHEN THE ACTUAL GAME PAGE BEGIN, IT STARTS FROM 0 SECONDS.. AS IF IT WAS THE VERY FIRST PAGE IN THE GAME?

  • You could create a global variable to store time in. In your event sheet count it up every second, and reset the global variable when you switch to a new layout.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Make sure you use wallclocktime. It gives you the time in seconds since the game began and is not affected by anything (like pausing the game etc)

  • Sorry to be a bother.. but could you possibly give me an example and tell me EXACTLY how to do it? Basically, I want every level to start from a time of 0 and then just count normal. I do know how to create a global variable but I'm not sure how to have it deal with the time issue for each level. Sorry.

    Thanks.

  • Here is what I would do:

    • Make global variable "timecount" and set it to Number, value=0
    • Create an event: System->Every 1 second; create an action: System->Add to timecount, value 1
    • Create another event: System->Compare instance variable->timecount = 5; create an action: System->Audio->Play sound = sound1
    • Create another event: System->Compare instance variable->timecount = 10; create an action: System->Audio->Play sound = sound2

    Then, when you go to another layout: System->At start of layout; System->Set value->timecount = 0. This essentially resets your global timer each time you navigate to another layout.

    Of course, you could probably also wrap most of this into a handy Function so you just call the Function each time you go to another layout; saves time having to copy/paste this for each layout!

    Hope this makes some sense. I'm not actually at my home computer to view the exact inputs/outputs but maybe this gives you enough to work with for now.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)