Can I save a snapshot in localstorage (Coloring Book Idea)

Get help using Construct 2

Post » Fri Sep 04, 2015 8:43 pm

Hi everyone,

So I have a project I'm trying to do where I'd like to be able to make a coloring book using the canvas plugin with the fill action. That part overall is ok. I can use the snapshot system action and paste it onto a sprite.. but what i don't get is how imagine you had more than 1 painting and wanted to move between them but not lose all your progress each time you leave a given layout / sprite..

Maybe there is a way to capture the canvas itself and restore that in a different way. snapshot seems like the easiest way to grab a picture. Ultimately the goal would be to restore the image in full detail (no artifacting) and such.

I imagine that in the coloring book mode there might be a couple of pictures to choose from and you go into that room to paint and such and then make changes and when you leave, save the changes till you come back again at a later time.

Thanks,
Caleb
B
59
S
9
G
1
Posts: 970
Reputation: 6,611

Post » Tue Sep 08, 2015 2:43 pm

bump.. is this something possible?
B
59
S
9
G
1
Posts: 970
Reputation: 6,611

Post » Tue Sep 08, 2015 3:40 pm

Well I have a screenshot manager & character creator/paint program(legacy) within my ADV Menu Template on the store,
https://www.scirra.com/store/royalty-fr ... plates-429
but I also have tutorial showing you how to save snapshots to webstorage and load them onto a sprite.
https://www.youtube.com/watch?v=KxZIFliucCo

But if you don't want to watch that, all you need to do is save "CanvasSnapshot" to a storage key. All you have to do is have a selected image number value global or instance varible and you can make a if key exists ""ss" & (ssSelected+1)" and have it incriment ssSelected to +1 if true, same with minusing. You need to have a empty sprite that loads from URL which you just put "WebStorage.LocalValue("ss"&ssSelected)".
it is rather easy to do, just beware that you want the image that you want to capture to be the only thing seen as it will capture the WHOLE canvas.
Last edited by undeadbobop on Tue Sep 08, 2015 3:51 pm, edited 1 time in total.
Need custom controls, video & sound options, and a PC like menu system with screenshot manager?
Image
B
23
S
5
G
2
Posts: 40
Reputation: 2,629

Post » Tue Sep 08, 2015 3:46 pm

snapshot undo seems like a bad idea. I don't know the solution to your problem, but I do now for undo to work this way you're going to need a picture a second. You're going to fill the user's hard drive. Imaging having to capture all the seconds back, and pixel change...

Unless you make it like notepad.. either only allow 5-10 undo steps.. or... undo is farther a part... like take a snap shot every minute or so... on project start you might want to consider deleting all files from the folder that aren't relative anymore..
B
7
S
2
Posts: 92
Reputation: 663

Post » Tue Sep 08, 2015 3:50 pm

Thats awesome @undeadbobop I'll check out the store item.

The video is very helpful, thanks!

Is it legacy because it's using webstorage still?
B
59
S
9
G
1
Posts: 970
Reputation: 6,611

Post » Tue Sep 08, 2015 3:55 pm

@part12studio Sorry Just updated more information on the post to avoid double post, it is legacy it isn't part of the master template and isn't being updated. Has nothing to do with anything with construct 2, sorry for the confusion.

As for undo functionality, it isn't a good idea to save the image rather have the brush marks as their own objects, so you can destroy them or make them transparent entirely in order of last created.
Doing this would allow you to tint the brush objects, and mess with their transparency(something I didn't do in the template), along with that you can make different shapes by having them as sprite objects, the only down fall is performance might not be good depending on how far you want the undo functionality to go back.
Need custom controls, video & sound options, and a PC like menu system with screenshot manager?
Image
B
23
S
5
G
2
Posts: 40
Reputation: 2,629

Post » Tue Sep 08, 2015 4:04 pm

ok cool yea I just bought the ADV product, thanks for that tip / lead. I'm going to look into this. doing a full screen capture is no problem. I can design around that.

Thanks,
Caleb
B
59
S
9
G
1
Posts: 970
Reputation: 6,611


Return to How do I....?

Who is online

Users browsing this forum: Ryan Kocourek and 25 guests