How do I do this is a better way? Missing something obvious?

Get help using Construct 2

Post » Fri May 30, 2014 5:57 pm

Hi everyone,

So I'm trying to save the users score even if they close the app with the home button (for example).

I tried using "On end of layout" but that doesn't seem to get called if you close the app externally (via red cross, home button, getting a call ect).

I have currently resorted to saving the score every 60 seconds - which isn't ideal at all.

Does anyone know a better way of constantly keeping track of the users score even if they terminate the app unexpectedly?

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Fri May 30, 2014 6:25 pm

When do you change the score?
Image ImageImage
B
169
S
50
G
169
Posts: 8,289
Reputation: 108,222

Post » Fri May 30, 2014 6:40 pm

newt wrote:When do you change the score?


Hi Newt!

The user score changes literally all the time. Its a kind of banking app, so the user score is always going up.

Any clues?
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Fri May 30, 2014 8:34 pm

@TMAJA Have you tried the 'WebStorage' object?
yupenglee.com | @JustOnlyYu
B
14
S
3
Posts: 16
Reputation: 872

Post » Sun Jun 01, 2014 10:49 am

arthology wrote:@TMAJA Have you tried the 'WebStorage' object?


Hi Arthology,

sorry, I wasn't clear in my original post!

I don't have any problems actually saving the score - I'm using web storage and it all works smoothly.

My problem is WHEN I save. Ideally I would like to save when ever the user exits the app! Unfortunately when I tried "On Layout End" this doesn't actually get called when the user closes the app via something like the home/back button on the actual phone.

Currently I am saving the score every few minutes, which obviously is undesirable as it places unnecessary load on the phone hardware!

Any ideas?

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Sun Jun 01, 2014 2:59 pm

Well, that all depends on the platform, if you want it mobile CocoonJS, IntelXDK or NodeWebkit, you can check put their respective plugins, they probably have some kind of quit trigger

A possible way would saving when loosing focus
Last edited by Whiteclaws on Sun Jun 01, 2014 3:06 pm, edited 1 time in total.
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Sun Jun 01, 2014 3:01 pm

Hi, nice question
I wonder how to do this too since lot of users exit with home button, open the task manager and swipe the app

How about saving every tick but I think that will make the phone work very hard, isn't it?
B
8
S
2
Posts: 203
Reputation: 1,169

Post » Sun Jun 01, 2014 3:29 pm

TMAJA wrote:
newt wrote:When do you change the score?


Hi Newt!

The user score changes literally all the time. Its a kind of banking app, so the user score is always going up.

Any clues?


It was a rhetorical question.
As in the the obvious thing you missed.
Image ImageImage
B
169
S
50
G
169
Posts: 8,289
Reputation: 108,222

Post » Sun Jun 01, 2014 4:18 pm

Whiteclaws wrote:Well, that all depends on the platform, if you want it mobile CocoonJS, IntelXDK or NodeWebkit, you can check put their respective plugins, they probably have some kind of quit trigger

A possible way would saving when loosing focus


Hi Whiteclaws,

Sounds like a great idea - how would I go about checking respective plugins? I've just had a look but I can't see a manual entry on that...

newt wrote:
TMAJA wrote:
newt wrote:When do you change the score?


Hi Newt!

The user score changes literally all the time. Its a kind of banking app, so the user score is always going up.

Any clues?


It was a rhetorical question.
As in the the obvious thing you missed.


I've really thoroughly thought about this and I'm just not seeing it? Maybe I'm just being an idiot! The score changes every tick...and surely I cant write to web storage every tick - that's going to be much worse more taxing on the hardware than writing every minute?

Sorry if I've totally misunderstood! :D

ijoin wrote:Hi, nice question
I wonder how to do this too since lot of users exit with home button, open the task manager and swipe the app

How about saving every tick but I think that will make the phone work very hard, isn't it?


Hi ijoin,

Thanks - yeah this has been something that's been bugging me for a while! I steered clear of saving every tick - I try to keep the number of every tick actions to a minimum anyway as they can be pretty hard on the limited resources on mobile - never mind if your actually writing to web storage.

Thanks everyone!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Sun Jun 01, 2014 4:45 pm

Just look at them in C2 xD, maybe there's a condition to do the job
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Next

Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 55 guests