restart time

0 favourites
  • 9 posts
From the Asset Store
Time rewind like in "Braid". Choose objects that will be affected by time rewind
  • I have a racing game which has a timer and records your time.

    I have a button to restart later at the end of the game, but it doesn’t restart the timer.

    How can I completely restart everything as if it’s a new game?

    Thanks

    Andy

  • yourTimer = YourSTartTime - time

    when you want to restart yourTimer just set variable yourSTartTime to time ( time is a System variable )

    Usually these actions will be in a function called reset, you can reset everything else there ( just copy/paste all variables and their initial values ) and just call reset when you want to restart things.

    But if you have a countdown before a race starts, like 3-2-1-go then you have to reset yourSTartTime on GO

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your help.

    I'm just starting out with Construct so i used the template 'racetrack' as a starting point.

    There is a 3 second countdown at the start of the race.

    There is a global number called TimeStartLayout = 0

    But I cannot see that variable referenced anywhere in the event sheet?

    I'm not sure how to use what you have generously provided.

  • Assuming you haven't changed it too much, the Racetrack template has an array, aTimes, that stores lap times for each car. It sounds like you want to reset this. See the "resetCP" function for an example on setting all array elements to zero.

    Starting out, you'll want to spend times on simpler, smaller examples and make sure to use the debugger to step through the events to see what's happening.

  • Thank you - I will look at that. I thought this was a simple one to start on!

  • I have been trying to replicate the function for resetCP - but I cannot get it to work.

    I have a button to 'replay' and I tried attaching a function to that to reset the 'aTimes' array. like this:

    But it's not doing anything.

    I'm not sure what I'm doing wrong?

  • Would you be interested in helping finish this on a paid basis?

    I'm running out of time, and although i want to learn all this, i think the learning curve is a bit steep!

    Let me know if you are interested.

    The things left to do are:

    1. Show the timer constantly on the screen so users can see their time in realtime.

    2. Fix the issue so that the restart game resets the timers.

    Let me know

    Thanks

    Andy

  • The action you did copy as is requires to be used in a loop, for the value of loopindex to change. Moreover, it requires to be called inside a function that will receive a paramater (function.param(0)).

    The reset an array, use the dedicated action "Clear".

    That should be enough to reset the array to 0.

    It is a template with certain complexities in terms of abstraction.

    If you are a complete beginner, you should probably get used to Construct first going through simpler templates and understanding how events work.

    The reading of the manual does help greatly for that.

  • Thank you - yes I think I have bitten off more than i can chew!

    If you (or anyone else) is interested in helping me finish this project (paid of course) that would be great. I will continue learning, but on something a little less complex.

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