Health-o-meter Sprite and Stamping

Last week I introduced my Health-o-meter sprite to the students.  It’s based on the Health Meter sprite Colleen Lewis, the professor of the Scratch Programming MOOC on edX, shared in the class.  I noticed a couple of students adding the sprite to their project or making their own version.  It will be interesting to see it in action.

Health-o-meter script and costumes

Health-o-meter script and costumes

In general, Code Club went well again last week.  Students are making progress on their individual projects and the number of issues that crop up are not overwhelming.

Although one student’s query had Alex, my high school volunteer, and I stumped.  The student is making a paint program similar to Paint Box, a Code Club World project we worked on earlier in the term.  She has taken the basic project and is adding more colors and features to it.  One addition she is working on is a stamp tool.  She has drawn a few sprites: rainbow, present, balloon, lightning and wants the user to be able to place copies of the stamp on their drawing. Scratch 1.4 has a stamp block in the Pen menu but she was having trouble getting it to work.  Alex and I both looked for help on Scratch Wiki, but were not successful in getting any code to work in the moment.

I spent some time today researching and testing some code and I think I have a couple of different algorithms for her to try tomorrow.  I did find a good resource through the Scratch Wiki – a Stamping tutorial and explanation, which helped get me started.

One way to work the stamp tool would be to have the sprite “stamp” itself in a random location on the stage.  Here I have a ball sprite and when the sprite is clicked, a copy of the sprite will appear on the stage in a random position.

stamp tool, version 1 -random placement

stamp tool, version 1 -random placement

That’s okay, but I’m sure the “painter” would like to pick the place where the stamp will go.  So I worked again to improve my solution.  Here the ball sprite moves with the mouse when clicked.  When the painter presses the “s” key, it makes a stamp of itself and the sprite returns to its original position on the toolbar.

Screen Shot 2015-03-24 at 7.49.02 PM

Stamp tool, version 2 – click and press “s”

That is better.  Now, though, I have to instruct the “painter” to press the “s” key to stamp. So I took one more try at the code.

Stamp tool, version 3 - on click

Stamp tool, version 3 – on click

This seems to work in my simple case, but I know in her paint program a lot of drawing happens with mouse down, for example, the pencil goes to the mouse-pointer. She will have to try it and test it.

Screen Shot 2015-03-24 at 7.58.06 PM

Something else could go in the repeat until – like the sprite could say “click to place”.  As always with code – different algorithms can give similar results.  One way may more pleasing to the coder than another.

I can’t believe there is only two more weeks of Code Club.  Students will need to finish up tomorrow and we all need to prepare for Showcase #2.