Animation frame to local storage

Get help using Construct 2

Post » Wed Jan 20, 2016 6:04 am

In layout i have one sprite with one default animation with two frames.
On start sprite have animation frame 0 but if i touch this sprite > set frame to 1

So now when i turn off app and turn on this touched sprite should have 1 animation frame
B
109
S
26
G
46
Posts: 1,885
Reputation: 35,166

Post » Wed Jan 20, 2016 1:20 pm

Save the displayed animation frame in a key of the local storage.
On start of layout, set the animation frame displayed to be equal to the value stored in the local storage key.

The first time you execute your game, the key does not exist, so the default value will be 0.
Be sure to then create a key using the default value.

This mechanic is explained in my Asteroid in less than 100 events tutorial, dealing with the scores.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
288
S
111
G
94
Posts: 7,332
Reputation: 69,160

Post » Wed Jan 20, 2016 8:41 pm

@Kyatric if i set few sprites and only one sprite will have changed animation sprite and saved to key. on start of layout when i check key automatically local storage will change state to all sprites right?
B
109
S
26
G
46
Posts: 1,885
Reputation: 35,166

Post » Thu Jan 21, 2016 11:05 am

If they are instances of the same Sprite object type and you are not picking any specific instance, yes.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
288
S
111
G
94
Posts: 7,332
Reputation: 69,160


Return to How do I....?

Who is online

Users browsing this forum: eochranek, Exabot [Bot], Nicolas951 and 22 guests