How do I get points earned every hour elapsed

Get help using Construct 2

Post » Tue Jul 01, 2014 6:08 am

Hi,

I want to include a Point System that you earn 10 points every 2 hours for example.
So would the best way be to just record the date and time in web storage. So ..
1. During the game monitor time passed, if 2 hours passed add 10 points.
2. Record the time on exit of the app, and check the time elapsed on next open.

I couldn't find anything relating to this, but I don't want to re-invent the wheel if someone has a plugin or something for this already? :)

Thanks
B
26
S
6
Posts: 39
Reputation: 1,574

Post » Wed Jul 02, 2014 4:47 pm

@devdan You can simple count the time using time, then check if it reach 2:00, save it to a variable when reached, plus, check it it reach VARIABLE+2 hours, and so on.
Image
B
107
S
24
G
18
Posts: 1,360
Reputation: 22,768

Post » Thu Jul 03, 2014 5:22 am

Thanks @TELLES0808. I guess that will work for when the mobile app is open. I was looking for something that you could calculate time passed while the app is closed as well.
B
26
S
6
Posts: 39
Reputation: 1,574

Post » Thu Jul 03, 2014 2:26 pm

Save the current system hour in a Global Variable and compare it again when returning to the game.

I think it's already implemented, if not, it can be achieved by using plugins.
Image
B
107
S
24
G
18
Posts: 1,360
Reputation: 22,768


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests