Like, instead of when you hit the restart button you go to a certain point and not the very start?
Squiffy games automatically save the progress in the browser's local storage.
The only way to start a game from the beginning is by clicking that restart button (unless the user clears their browser's local storage).
So, hiding that restart link is not advised, but you can do it by hiding the HTML element via JS (or jQuery).
You should be able to use the browser's local storage to store checkpoints.
There are issues with this, right? What do you lose if you save? I've not had a lot of luck restarting a game. Well, one of my games.
I've not had a lot of luck restarting a game. Well, one of my games.
Is it public? I could test it on my system for you, just to see if it doesn't like me either.
Also, to avoid working on what I'm supposed to be working on, I'm about to make a quick game to test checkpoints. :)
I tried to find a way to do this by only using the game's code -- without editing any CSS or HTML files.
This seems to work, but it seems like it could be done better:
BAD CODE REMOVED
Clicking RESTART should ask if you want to start from the beginning or from the checkpoint:
Ah! I was writing a reply at the same time as mrangel, and his post made me realize that my code was no good. All my code really did was use
squiffy.story.go() to go to whatever section name was saved in the local storage under "checkpoint". That did not really create checkpoints.
You could implement a kind of checkpoint by looping over all attributes in localstorage and serialising them into a single attribute; if the player wants to go back to the checkpoint, you just unpack them all.
If you want to disable 'saving' between checkpoints (which is a bit weird, because attributes are always in LocalStorage, which the browser saves between sessions), you could set the
_transition script to return to the previous checkpoint; this runs as soon as the player opens a game which has existing data in LocalStorage. You would presumably want to replace the
squiffy.story.save function with one which doesn't save the output (you'd do that manually at checkpoints), but which resets the value of
_transition to prevent
squiffy.story.go clearing it.
I don't think this would be too hard to achieve.
Ah, we answered at the same time :)
KV has a simpler kind of checkpoints, which would allow you to return to a specified checkpoint, but would keep any flags or attributes set after that point.
KV has a simpler kind of checkpoints
Oh, yeah... It was no bueno.
It wouldn't even have cleared anything saved between creating the checkpoint and restarting from the checkpoint.
As soon as I read your post, I was like, "oh, damn it! I forgot to cover 3/4 of the bases!"