Discuss Scratch

groovythemes2
Scratcher
11 posts

Paint Project Help!!

Hey! I am in school (so this is my second account) and I have been working on updating my paint program. One of my updates is to make an eraser to erase things you want to, not to clear the whole board. So if someone can help me out with the script for that, that would be great! Thank you

-Project I am working on: Paint Program

Click me for the project

My other account has the original project, but the one on this account is getting fixed and so will the original

The original project (the bad one xD)

-The only difference between the two projects is that one has a better layout, and the other has the option of changing brush size.-

*Please note that the backdrops change, so if I was to change the “eraser” colour to the colour of the current backdrop, then change the backdrop the “eraser” marks will be visible. Thank you!

Last edited by groovythemes2 (Jan. 14, 2016 14:14:06)

deck26
Scratcher
1000+ posts

Paint Project Help!!

The normal way, as you're mentioned, is to change the pen colour to the background colour. If you can't do that but want to carry on using the pen to draw the only option I can see is to keep a log of all pen movement, including with the eraser colour, and redraw it in a custom block when you change the background.
groovythemes2
Scratcher
11 posts

Paint Project Help!!

deck26 wrote:

The normal way, as you're mentioned, is to change the pen colour to the background colour. If you can't do that but want to carry on using the pen to draw the only option I can see is to keep a log of all pen movement, including with the eraser colour, and redraw it in a custom block when you change the background.

Thank you, I am going to try that. And I have a really dumb question, how do you log it? xD If you don't know, I can figure it out lol
RobotDJS
Scratcher
68 posts

Paint Project Help!!

I would suggest making it so that you choose the background color at the beginning and you can't change it afterwards. Then do what you thought of before…
ifbackdropname=purple thensetpencolorto

This is just an idea. Someone else probably has a better answer, so if you don't like this idea, wait for another response.
Hope this helps
Good luck!
groovythemes2
Scratcher
11 posts

Paint Project Help!!

RobotDJS wrote:

I would suggest making it so that you choose the background color at the beginning and you can't change it afterwards. Then do what you thought of before…
ifbackdropname=purple thensetpencolorto

This is just an idea. Someone else probably has a better answer, so if you don't like this idea, wait for another response.
Hope this helps
Good luck!

Thank you for your help Yeah, at this point I might just make the backdrop choose random or something so it can't change lol
deck26
Scratcher
1000+ posts

Paint Project Help!!

groovythemes2 wrote:

deck26 wrote:

The normal way, as you're mentioned, is to change the pen colour to the background colour. If you can't do that but want to carry on using the pen to draw the only option I can see is to keep a log of all pen movement, including with the eraser colour, and redraw it in a custom block when you change the background.

Thank you, I am going to try that. And I have a really dumb question, how do you log it? xD If you don't know, I can figure it out lol
Essentially you need to add information to one or more lists each time the pen moves or changes state (up/down). I'd be tempted to use a single list with each item either being a simple 1 or 0 to indicate the pen moving up or down OR being a pair of x,y coordinates. (Use a separator or add 400 to each value to ensure each is 3 digits so you can get them back non-ambiguously - otherwise 1212 = 1,212 or 12,12 or 1, 212?)

Since your drawing sprite is just following the mouse you'll need some way of managing this. Perhaps a custom block with no refresh looking for changes in a variable indicating pen state and a move of the mouse of more than so many units when the pen is down.

A simpler method might be to record pen state and position in one list item and in a forever loop you record the change of pen state or, when the pen is down, all occurrences of the x or y position changing.

Last edited by deck26 (Jan. 14, 2016 14:47:40)

groovythemes2
Scratcher
11 posts

Paint Project Help!!

deck26 wrote:

groovythemes2 wrote:

deck26 wrote:

The normal way, as you're mentioned, is to change the pen colour to the background colour. If you can't do that but want to carry on using the pen to draw the only option I can see is to keep a log of all pen movement, including with the eraser colour, and redraw it in a custom block when you change the background.

Thank you, I am going to try that. And I have a really dumb question, how do you log it? xD If you don't know, I can figure it out lol
Essentially you need to add information to one or more lists each time the pen moves or changes state (up/down). I'd be tempted to use a single list with each item either being a simple 1 or 0 to indicate the pen moving up or down OR being a pair of x,y coordinates. (Use a separator or add 400 to each value to ensure each is 3 digits so you can get them back non-ambiguously - otherwise 1212 = 1,212 or 12,12 or 1, 212?)

Since your drawing sprite is just following the mouse you'll need some way of managing this. Perhaps a custom block with no refresh looking for changes in a variable indicating pen state and a move of the mouse of more than so many units when the pen is down.

A simpler method might be to record pen state and position in one list item and in a forever loop you record the change of pen state or, when the pen is down, all occurrences of the x or y position changing.

Ah interesting, I shall challenge myself and try this! Thank you!
footsocktoe
Scratcher
1000+ posts

Paint Project Help!!

Here is a simple pen recorder that shows how a list can be used

https://scratch.mit.edu/projects/92499286/
groovythemes2
Scratcher
11 posts

Paint Project Help!!

footsocktoe wrote:

Here is a simple pen recorder that shows how a list can be used

https://scratch.mit.edu/projects/92499286/

Thank you

THANK YOU EVERYONE FOR YOUR HELP! I APPRECIATE THIS, YOU HAVE NO IDEA HOW MANY “PAINT PROJECT” FORUMS I MADE AND NO ONE COMMENTED LOL

Powered by DjangoBB