How do I save canvas snapshots in local storage?

0 favourites
  • 3 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)