From follow the mouse to doing art

This starts simple (follow the mouse) then introduces random art, then offers challenges to control the art better
Draft worksheet: follow_mouse_to_random_art.docx - Google Docs

Snap XML: Snap! follow_the_mouse (berkeley.edu)

That's nice. I like starting with follow-the-mouse.

I upgraded the worksheet to provide some scaffolding for the challenges. Also made a version 2 which illustrates the challenges:
Worksheet: follow_mouse_to_random_art_2.docx - Google Docs
Snap XML: Snap! follow_the_mouse_2 (berkeley.edu)

Interesting. Instead of using variables for the settings I'd just take the SET PEN blocks out of the original script and put them right in the IF blocks:


Okay, I did use a local variable for the crayon, but not a global to pass information between scripts.

If you want blue, black, and brown as color options, then you have to build a dictionary instead of my first-letter kludge. Or look for a capital letter instead of just the first letter, and then include Blue, blacK, and browN in the color list.

Thanks Brian. I learnt a few new things from that code.
eg. (1) didn't know that selecting any key in the when key pressed block automatically created a local key variable (2) didn't know you could use colour names of the crayons rather than numbers (I had a look but couldn't find the first one in the manual, suspect neither is there)

Some questions
image

  1. Is that if statement necessary, it seems to work with just setting the pen directly
  2. I can't see that particular not equals block in Operators, is it from the Library?
    image
    (this is the one I can see)

I should think about incorporating your code into the worksheet, perhaps have an implied or explicit beginner, middle and advanced section (?)

The not equals is hidden behind the relabel option when you right-click on the block when its dragged into scripting area.

Or just carry on using the 2 stage not operator - easier for beginners

It is a relatively recent addition and is hidden so as not to clutter up the category - there are a few blocks like this in Snap! so worth having a little look around :slight_smile:

image

Non-teacher here, this is actually really cool and I think your students will like this!

The value of CRAYON will be an empty string (a misfeature of FIND FIRST, one of at least two misfeatures about it) if the key isn't the first letter of something in the list. I guess it wouldn't hurt to call SET PEN TO CRAYON with an empty input but it won't do anything useful either.

Color names are mentioned in the manual, p 127, and much more about color there too! I can use the information at the bottom of p. 133 to add colour to squirals, "We recommend “fair HSL” for zeroing in on a desired color"
image