How do I save canvas snapshots in local storage?

Get help using Construct 2

Post » Mon Mar 14, 2016 10:31 am

Can't seem to find any working examples of this...I know how to take a Canvas Snapshot and I can get it to download but using Invoke Download but I can't seem to be able to store a screenshot in Local Storage and then retrieve it when running the game later.

Is this possible in C2?
B
5
Posts: 6
Reputation: 245

Post » Mon Mar 14, 2016 10:56 am

No, but you can save the game's state and store that then restore it, and take your picture.
Otherwise you would have to convert the image to something like base64, and store it as a string in local storage, or store it on a server.
It's doable, but ill advised because of the waste of memory on both of those.
Image ImageImage
B
168
S
50
G
169
Posts: 8,281
Reputation: 108,191

Post » Mon Mar 14, 2016 12:02 pm

Thanks Newt - by base64 do you mean a Data URI? Ashley mentions this here...https://www.scirra.com/tutorials/526/ho ... -savegames

"whenever you save to a slot, also write a WebStorage key that indicates the slot has been saved to. You could add some other metadata like the player name or even a small screenshot of the game as a data URI"

...that's basically what I'm trying to do - I've got 12 slots, and I can save different game states in each slot with a small thumbnail - but when I load an earlier state, it reverts all the thumbnails to how they were at that point

What would be really cool is if you could change an objects "No-Save" state in code. Then I could set the blank slots to "No-Save" when saving, but set them to "Save" When they have a thumbnail in them. Then, when I load an earlier slot, all the filled slots will be left alone.
B
5
Posts: 6
Reputation: 245


Return to How do I....?

Who is online

Users browsing this forum: Fradno and 17 guests