How do I Save a game and have it record play time

Get help using Construct 2

Post » Sun Apr 17, 2016 10:55 am

Such as this if ive been playing for one hour and then hit save id like to see a load and that save slot to show up as save 1 : 00:01:00 as in dd:hh:mm ? I dont think Anyone covered that one yet ?
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Sun Apr 17, 2016 3:30 pm

Create a start and stop timer event so the timer only runs when the player is running the game (e.g., is not in the main menu or in pause mode). Include the timer variable into your save game slot name.

Check this tutorial out:

https://www.scirra.com/tutorials/173/time-counter

That should do it!
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Sun Apr 17, 2016 4:47 pm

Use a time plugin or function and look at these very basic save events, could probably be evented more elegant, but it will do the job.
Example used every 1 sec for seconds, which is not recomended.

demo: https://dl.dropboxusercontent.com/u/657 ... index.html

capx: https://www.dropbox.com/s/xsyfbytwa0yf6 ... .capx?dl=0
B
25
S
11
G
9
Posts: 136
Reputation: 6,657

Post » Sun Apr 17, 2016 8:02 pm

i love both of you guy example and I will use both in a way but i have to ask what does the Percent sign do in java math ?
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Mon Apr 18, 2016 5:10 am

% is the modulus operator, mod on your calculator. It divides the number by the second and returns the remainder.

5 % 2 = 1

If you count your time in seconds and you have 5624 seconds, you can find how many minutes there are by doing floor(5624/60) and how many seconds by doing 5624%60.

It is VERY useful when calculating angle of direction, time, currency... anything that loops back to zero.
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Mon Apr 18, 2016 5:21 am

Oh cool I wished id known that many year ago. I remember having to do the counter by manual as in frame count to change the next number it was crazy.

But yeah Im having a new problem The save n load works fine For one time and then it start to lose it text ....load buttons.

Im confuse to why its doing that. If any can find that one.....Why would it work once but then falls apart. here the capx. https://www.dropbox.com/s/wzyv39sn5prhq ... .capx?dl=1 It will auto download. Note: the battle isnt ready yet so dont go testing it lol

Oh And Id like to ask for input for the music volume if you guy think its too loud ?

The save n load function is being weird on me. The codes are on Start menu, UI and save time event sheet. and yes I tried to separate them to make easier of finding.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests