How to Save >> Template: Instance variable >> each clicks

Get help using Construct 2

Post » Wed Dec 16, 2015 11:05 am

A Template comes with Construct 2 ... Instance variable: Level Begineer

in this Template each instance has their own click counting separately
.
But if i want to remember
means i want to save all click of each instance with local storage
than how we can do it
.
i have try this by myself but it saving only one "highest click" for each instance.

pls tell me how we can do this
Image
B
62
S
38
G
42
Posts: 623
Reputation: 30,320

Post » Wed Dec 16, 2015 11:11 am

Just to be sure, you want the value of the instance variable of a sprite into a local storage?
Image



The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
55
S
17
G
90
Posts: 1,111
Reputation: 59,145

Post » Wed Dec 16, 2015 11:17 am

in this file every instance is counting by a text file
but now i want every instance should be remembered by local storage
then how it could be possible ???
Image
B
62
S
38
G
42
Posts: 623
Reputation: 30,320

Post » Wed Dec 16, 2015 11:43 am

In this particular case,it's easy..just use Array
Template_InstanceVariable.capx
Image
B
63
S
23
G
7
Posts: 1,479
Reputation: 10,794

Post » Thu Dec 17, 2015 10:12 am

this is cool
its saving
but could you explain with comment in each event that what is that doing with command
so that i can grab it for my practice
Image
B
62
S
38
G
42
Posts: 623
Reputation: 30,320

Post » Thu Dec 17, 2015 3:58 pm

luckyrawatlucky wrote:..but could you explain with comment in each event that what is that doing..


I'm sorry but I think that's a little bit excessive...
BtnRestart on clicked-Restart Layout
i think this is clear..also LocalStorage..
On Start-check
if missing -do someting
if exists-get
on get-do something

only the array can be a little confusing..if you do not visualize how it actually looks

so..in example you have 5 instance of same sprite..first instance always have IID=0;second=1
just like frames in animation..array same case..first cell have index=0;second=1 etc
Image
so when you click on instance with IID=2..you save "clickCount"value in array on index 2
Image
then you save Array as Json...
Image
Image
B
63
S
23
G
7
Posts: 1,479
Reputation: 10,794


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest