Pages: 1
Topic closed
The drawing_pencil (in the Things folder in Scratch) comes with one script that puts down a blue pen and draws as the mouse is clicked and dragged. I would like the drawing_pencil to draw but only when it is within the bounds of a certain area of the Stage (i.e., "color within the lines"), but I am not smart enough to figure out how to do it (please know I have tried -- for about three days). Would anyone mind helping?
Last edited by rico (2008-12-08 07:25:27)
Offline
You could do this:
[blocks]<when green flag clicked>
<forever>
<if><mouse down?>
<if><touching color[ color
<pen down>
<end>
<else>
<pen up>
<end>[/blocks]
That will make the pen draw only if it is touching certain color.
Offline
technoguy: thank you for the reply. i was able to get limited success with your suggestion. i think i'm not sure whether the "if" blocks go inside each other or on top of each other. i will experiment a little more.
JSO: what an elegant solution. the results you got are exactly what i want to do, now i just have to figure out how you did it.
THANK YOU!
Offline
rico wrote:
technoguy: thank you for the reply. i was able to get limited success with your suggestion. i think i'm not sure whether the "if" blocks go inside each other or on top of each other. i will experiment a little more.
JSO: what an elegant solution. the results you got are exactly what i want to do, now i just have to figure out how you did it.
THANK YOU!
JSO is a very clever guy...he has made a masking sprite (sprite1) with a cat-shaped hole in it lined up right over the cat picture on the background. The pen will never draw over a sprite (it only draws on the background) so the pen can only be seen through the cat-shaped hole in the masking sprite. If you hide sprite1 you will see that the pen is actually drawing everywhere...but you can only see it on the cat because of the masking sprite.
Offline
Is this for general drawing program or is it going to be a specific picture that can be coloured?
If the former, this method will not really work for you. Finding a method that will could be very tricky, especially as scratch has no "in-program colour sampling" which can pick up and use the colour as a variable.
Offline
Topic closed
Pages: 1