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
Develop games in your browser. Powerful, performant & highly capable.
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.
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?
If they are instances of the same Sprite object type and you are not picking any specific instance, yes.