Discuss Scratch
- Discussion Forums
- » Suggestions
- » Save Pen Strokes
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
This suggestion would allow pen actions (sprite movements, pen down/up, pen size, perhaps pen color) to be stored in a variable so that they can be quickly repeated elsewhere.
All blocks should work like normal (including the pen blocks, so that the strokes are drawn on screen like normal) so that variables and if-blocks can affect what pen strokes are stored. This would be different from using a custom block, since variables are re-read and if statements are re-evaluated every time they are executed, which would not be the case with this suggestion.
Example usage:
All blocks should work like normal (including the pen blocks, so that the strokes are drawn on screen like normal) so that variables and if-blocks can affect what pen strokes are stored. This would be different from using a custom block, since variables are re-read and if statements are re-evaluated every time they are executed, which would not be the case with this suggestion.
save pen strokes to [drawing v] {I think the “variables” for pen strokes could be a new data, in addition to variables and lists.
go to x: (0) y: (0)
pen down
move (10) steps
...
pen up
} :: pen
draw [drawing v] with direction (90 v) and size (50) % :: pen // the starting point is the same as the sprite's current position
Example usage:
save pen strokes to [drawing v] {Data size might be a problem if used this way, though.
repeat until (key [space v] pressed? :: boolean)
wait until <mouse down?>
go to [mouse-pointer v]
pen down
repeat until (not (mouse down? :: boolean) :: boolean)
go to [mouse-pointer v]
end
pen up
end
} :: pen
wait until (not (key [space v] pressed? :: boolean) :: boolean)
... // draw it wherever you want
Last edited by -Rex- (March 17, 2019 22:10:21)
- Flipped_
- Scratcher
500+ posts
Save Pen Strokes
I think that you could accomplish exactly this with My Blocks. What makes this feature different from My Blocks?
☄️ Hey! I'm Flipped_. ☄️
Here, you can sit down in that chair over there. No no, that one. The other
one is reserved for my pet coelacanth.
I guess we wait now. Feel free to drink some orange juice
in the meantime.
———————————————
Here, you can sit down in that chair over there. No no, that one. The other
one is reserved for my pet coelacanth.
I guess we wait now. Feel free to drink some orange juice
in the meantime.
———————————————
- CKCG
- Scratcher
100+ posts
Save Pen Strokes
Can't this be done with custom functions?
edit: lol while i was typing this out i got sniped
define Pen1No support.
pen strokes here :: #808080
when green flag clicked
Pen1 :: custom
edit: lol while i was typing this out i got sniped
Last edited by CKCG (March 17, 2019 21:54:56)
I'm no longer active on these forums.
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
This would theoretically be simpler and faster if you want to store dynamically-generated data. I think that you could accomplish exactly this with My Blocks. What makes this feature different from My Blocks?
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
The problem is that if you want to store pen strokes that are dynamically-generated, you have to implement some way to interpret a list or string, which many Scratchers may not want to do. Can't this be done with custom functions?define Pen1No support.
pen strokes here :: #808080
when green flag clicked
Pen1 :: custom
edit: lol while i was typing this out i got sniped
- CKCG
- Scratcher
100+ posts
Save Pen Strokes
What do you mean by dynamically-generated pen strokes?The problem is that if you want to store pen strokes that are dynamically-generated, you have to implement some way to interpret a list or string, which many Scratchers may not want to do. Can't this be done with custom functions?define Pen1No support.
pen strokes here :: #808080
when green flag clicked
Pen1 :: custom
edit: lol while i was typing this out i got sniped
I'm no longer active on these forums.
- Jonathan50
- Scratcher
1000+ posts
Save Pen Strokes
Do you mean in an ordinary variable? Would the watcher become blank?
(Snap! has first-class procedures which make this easy. There is an example project called Vee which you can find by going File->Open…->Examples.)
(Snap! has first-class procedures which make this easy. There is an example project called Vee which you can find by going File->Open…->Examples.)
Last edited by Jonathan50 (March 19, 2019 05:29:38)
Not yet a Knight of the Mu Calculus.
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
Seeing as how even lists aren’t first-class, I don’t think a new first-class data type should be added. I also don’t think regular variables should be used. Do you mean in an ordinary variable? Would the watcher become blank?
(Snap! has first-class procedures which make this easy. There is an example project called Vee which you can find by going File->Open…->Examples.)
- Jonathan50
- Scratcher
1000+ posts
Save Pen Strokes
Okay. But first-class procedures are much more general, for example, if you wanted to use this to make a PTE like -Snipet- mentioned, unless the Scratch Team were to allow dropping reports into the dropdowns, you'd need an IF block for every possible character, whereas with first-class procedures you could use the Unicode codepoint as an index into a list of scripts for drawing characters. First-class procedures even make message passing simple (no broadcasts or clone IDs.) However, your example use case would be much less clear. Seeing as how even lists aren’t first-class, I don’t think a new first-class data type should be added. I also don’t think regular variables should be used.
Not yet a Knight of the Mu Calculus.
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
I know what first-class procedures are. However, I don't think the Scratch Team would agree to implement it in Scratch.Okay. But first-class procedures are much more general, for example, if you wanted to use this to make a PTE like -Snipet- mentioned, unless the Scratch Team were to allow dropping reports into the dropdowns, you'd need an IF block for every possible character, whereas with first-class procedures you could use the Unicode codepoint as an index into a list of scripts for drawing characters. First-class procedures even make message passing simple (no broadcasts or clone IDs.) However, your example use case would be much less clear. Seeing as how even lists aren’t first-class, I don’t think a new first-class data type should be added. I also don’t think regular variables should be used.
- LegoManiac04
- Scratcher
1000+ posts
Save Pen Strokes
This can be kind of done with lists. It's something that I'm still working on, but if you want to see what I did, look here: https://scratch.mit.edu/projects/292671535/editor
But, I can see how this could be very useful, so Support.
But, I can see how this could be very useful, so Support.
Last edited by LegoManiac04 (March 20, 2019 22:56:13)
- -Rex-
- Scratcher
500+ posts
Save Pen Strokes
https://scratch.mit.edu/projects/292671535/editorI know it can be done with lists, but my point is that many Scratchers may not want to use lists for something like this. This can be kind of done with lists. It's something that I'm still working on, but if you want to see what I did, look here:
But, I can see how this could be very useful, so Support.
- Discussion Forums
- » Suggestions
- » Save Pen Strokes