I want to save and load level data - preferably as separate files. How do I do this.
The data will be grid based - each entry in the grid will represent a location on the layout (x and y in the grid). The status of that location (what is there and it's state) would be stored in the grid.
I've looked at webstorage, json and arrays and this seems to be a way to do what I want, but the semi-temporary nature of webstorage worries me and that I can't see a way to access several files (levels) individually - ultimately the levels would be retrieved (from a server) as needed in batches (level packs).
I sort of understand that I can store an array as a json string - I don't know how I would get that string to a file and how I would retrieve it later.
Here's a description of the sort of information that'll be saved (per level)...
A grid (currently 13x13 but may change) with each entry containing a string which will 'describe' what is in that location - My program will parse the string to recreate the screen (layout) on load.
tileset, tile number, health - would be represented by a series of characters eg "001 012 100" - would mean tileset 1, tile 12 and 100% health.
I hope I have explained clearly enough for you to understand what I want to do.
Thanks for reading!