Discuss Scratch

satyakiG
Scratcher
32 posts

Save code system

i want to know how to make save code system for my paint project to save drawings
deck26
Scratcher
1000+ posts

Save code system

So you need to start by working out what you need to save. For saving drawings you can either save the data for each line as you draw it so you can redraw in the same order - so you'd need a code for pen colour, size and start position followed by a sequence of x,y values. So perhaps you'd record the x and y position each time the mouse moved more than 2 pixels when drawing or the pen up/down state changed.

Alternatively you scan the screen after the drawing is done. If you're using a limited number of colours you can use a single pixel sprite and move it to every pixel on screen and loop through the colours and check for touching. This is very slow if you allow any colours. There are projects that do this scanning.

But both are likely to result in a lot of data so exporting a list may be the best way to save rather than a normal save code.
satyakiG
Scratcher
32 posts

Save code system

ok will try. thank you

Powered by DjangoBB