A clicker game that saves score

Basically what I’m attempting to do is make a clicker that keeps score, which I know how to do, but if I were to go to a different frame and go back, like a pause screen or a menu on a different frame, I want it to keep the score when i go back until I click a certain button which will reset the cookies.

To elaborate further: What i want to do is, say I click something on frame A until it gets to 50 points, then i click a button that takes me to frame B, and if i click a button to take me back to frame A my score will stay at 50.

I know there’s an example with setting a word to something after it’s clicked, but could that be implemented with a score too?

1 Like
save between 2 frames

I would think that it already should do what you want without doing anything at all, but if not, do this:

  • at the very start of the project, assign a variable, like “points”, to 0
  • when you get to the actual clicker, set the number of points to “points”
  • when you click, add to “points”
  • when you leave, “points” will remain
  • when you come back, “points” will still remain
  • throughout the whole clicker game, any visuals (like a score) will constantly update based on “points”
save between closing tab and re-opening tab of project (you didn't ask for this but you might want to use it)

this may help you. https://www.w3schools.com/jsref/prop_win_localstorage.asp

2 Likes

The only bit of this that confuses me is this, isn’t points only for numbers? I’m probably interpreting it wrong, but when i put this.Points +=points it says i need to put a number. If you could put some script examples that could probably help.

if(whatever conditions you want){
project.points+=1
}

I put that and nothing’s changed, here’s a link to an example project i’ve put together testing the info that’s been given, hopefully that’ll give a specific example where i went wrong

https://drive.google.com/file/d/1pcibCnzwbcksuNZy08_cwI0aTF9WLz7G/view?usp=sharing