Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Elliot, would you be willing to show sample code on how to give game player the ability to save game to local storage, and retrieve saved game from same local storage?

Sure! I’d recommend starting with this patch here, and use its save and load functions. The default format is "session" (set in storage.js), so you’ll need to change the value of storage_defaultformat to "local", but that should work pretty seamlessly otherwise!

To give your players the ability to actually save and load themselves, you’ll probably want to attach those things to a UI element (like an HTML button, as seen in Inky’s web player — the one get when you export a project to web).

Thanks. Say, for instance, that I occasionally offered the player a Save Your Game link:


[Save Your Game]

What would the code in my Ink look like that attached this link to the memory card function call?

I’d probably implement that via a simple tag. Just #save or something. Then, in your project.js, you’d add a new tag handler that runs the save function!