Ok. So, my four weeks of 170% work load is over and I’m ready to do this.
Just to be clear about how my simple widget works. It’s about 120x120px. I have four scenes, the first is just blank/ a white rectangle on a white background, the next scene has a bronze star in it. Next scene has a silver star, and the last scene a gold star. You go to the next scene by clicking the rectangle or star.
Now to the coding. (I feel like I have no idea what I’m doing)
I understand that by writing localStorage.stars i create a variable that will be able to store info about the last visited star in my widget. I’m guessing I just named the variable ‘stars’, right?
Ok, so logically, I guess I somehow need to tell localStorage.stars to store the name of the scene I’m at every time a new scene is visited. Should there be js-code in each scene then, telling localStorage that this scene has just been visited?
Secondly I need to have some kind of code in the first scene saying that IF there is any data pointing to a scene in localStorage.stars then I will go there. And if localStorage.stars is empty or filled with “1” then I’ll just stay on scene 1. I guess I could assign value 1 to the variable right away.
But if I’m using scenes, can I move to another scene using this code:
Isn’t this only for moving within a scene?
I feel like I kind of know what I need to do, but I have no idea where to start.