Discuss Scratch

greatG
Scratcher
5 posts

how to undo in a script the last pen drawing?

I'm using a remix of a painting project and I would like to have the possibility of clear the last painting and not all, but I only have this possibility with clear (in pen).
Anyone knows'
Thank you
NeonFrostburn
Scratcher
100+ posts

how to undo in a script the last pen drawing?

Can you send a link? Share it, then post a link in these forums. You can turn comments off, say WIP (Work in Progress) in the title, and in the notes and instructions say you only shared it for help. Then, it'll be fine.
greatG
Scratcher
5 posts

how to undo in a script the last pen drawing?

Of course, thank you:

This is the original ‘Mona Lisa’ but in my area:
https://scratch.mit.edu/projects/162205966/

There is a clear button that clear all colors as I said. I'm trying to count in a variable every time the pen is up and then down, while inside the painting zone. I mean using the same color. But I'm not going forward with it.
footsocktoe
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

greatG wrote:

Of course, thank you:

This is the original ‘Mona Lisa’ but in my area:
https://scratch.mit.edu/projects/162205966/

There is a clear button that clear all colors as I said. I'm trying to count in a variable every time the pen is up and then down, while inside the painting zone. I mean using the same color. But I'm not going forward with it.

So you only want to clear the last color painted and not all colors?

There is no easy way to do that, but it is possible. You would need to record all the pen moves and color changes, then after you clear, redraw the moves with the exception of the moves following the last color change.
greatG
Scratcher
5 posts

how to undo in a script the last pen drawing?

Thank you, it makes all sense. If I'll achieve the goal I'll let you know
greatG
Scratcher
5 posts

how to undo in a script the last pen drawing?

You know, its more complex since you can make make mistakes even within the same color. So I'm trying to record in variables every time the pen is up and down again within the same color..
Thank you anyway!
footsocktoe
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

greatG wrote:

You know, its more complex since you can make make mistakes even within the same color. So I'm trying to record in variables every time the pen is up and down again within the same color..
Thank you anyway!

You could simplify the erase procedure by drawing on a background that is a color the pen is capable of. Then all you would have to do to erase is draw over what you already drew, maybe with a size 20 or larger pen, and make it the background color.
gtoal
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

draw by placing clones rather than using the pen. stamp the oldest clone and recover it for the newest pixel. this way the last 300 pixels can always be undone.
greatG
Scratcher
5 posts

how to undo in a script the last pen drawing?

I'll try, thank you.
It will be so easy if we can do undo inside script, but I don't see how!
footsocktoe
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

greatG wrote:

I'll try, thank you.
It will be so easy if we can do undo inside script, but I don't see how!

Whatever moves the pen makes can be recorded and repeated after you clear the screen. To undo any moves, you simply do not repeat them.
ShawnZ128
Scratcher
1 post

how to undo in a script the last pen drawing?

me too
RGEFuentes06
Scratcher
75 posts

how to undo in a script the last pen drawing?

well instead of pen you can use clone markings but i dont think that works because there is a delete this clone block that undo's the last clone
Deletethisclone
you can't just erase all you work!
BUT MAYBE SOMEONE CAN HELP!
Who knows?
Also this Fruit basketball game
This is not a pen game but i do have some pen games in my albums!
Ok bye!

Last edited by RGEFuentes06 (Nov. 4, 2020 20:46:57)

Nezon
Scratcher
1000+ posts

how to undo in a script the last pen drawing?


RGEFuentes06 wrote:

well instead of pen you can use clone markings but i dont think that works because there is a delete this clone block that undo's the last clone
Deletethisclone
you can't just erase all you work!
BUT MAYBE SOMEONE CAN HELP!
Who knows?
Also this Fruit basketball game


This is not a pen game i do have some!
Click me or not
ok bye!

ShawnZ128 wrote:

me too
Please don't necropost.

Last edited by Nezon (Nov. 4, 2020 20:46:22)

minty_snowflake
Scratcher
2 posts

how to undo in a script the last pen drawing?

I´m trying to make a drawing game but I don´t know how to make a undo and redo script that can redo a mistake when drawing with the pen…
Oumuamua
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

minty_snowflake wrote:

I´m trying to make a drawing game but I don´t know how to make a undo and redo script that can redo a mistake when drawing with the pen…

Save coordinates in a list when drawing, to erase some part delete the items with the coordinates for that part, clear all and redraw.
Please do not necropost, if you need help create your own topic. Thanks.
Shimmer39
Scratcher
8 posts

how to undo in a script the last pen drawing?

whenclickedsayNo ideafor2secs
setpencolortodon'tlookatme
AntonL1kesPotato
Scratcher
1000+ posts

how to undo in a script the last pen drawing?

Shimmer39 wrote:

whenclickedsayNo ideafor2secs
setpencolortodon'tlookatme

… necroposting for 3 times? If you don't know what necroposting, take a look at thttps://en.scratch-wiki.info/wiki/Necropost

Last edited by AntonL1kesPotato (July 11, 2021 12:02:52)

Powered by DjangoBB