Coding Workshop Procedures

Notes:

Ice-Breaker:

Note to instructor: This tutorial is a 10-step procedure. After the first few steps, some students will adopt an “I got this” attitude and start playing with what they have already learned. It is important that all students complete all 10 steps of this tutorial.

Note: This is a good place to introduce Monitors. Monitors in Scratch show the value of an item that may change, such as a sprite’s position,  the value of a variable, a sound’s volume and more. In this case, Go to MOTION and check the boxes for x position and y position.

Have students look at these values on the stage as the sprite is moving about the screen. -- Typically monitor are used during development and turned of once the program is “released.” There are many exceptions to this, the most obvious would be Score.

The following variation changes the line color with each movement

Examples of initialization

Challenge: make background change after a specified time and/or key press:

Examples of changing backgrounds.


Practice using ASK and ANSWER.

Assigning user input to a variable

Any variable can hold only one value at a time. Assuming we will ASK for more information in addition to name, it is a good idea to always assign the value of ANSWER to a new variable. In the example above, let’s create a variable called name and SET the value of name as soon as the user types in their names.

By storing the value of answer in the variable called name, we can ASK the user for more information without losing the value of the first ASK command. In the example below, when we ASK for the user’s age, we still have their name.

Challenge: Describe the output of this code:


Possible answer:

Creating Calculations with numbers input by users using the ASK command.

In the cat’s script

In the Stage’s script

Review

Example: If score > 20 AND Game_Start = Yes, the BROADCAST next level.

Practice: Create the scenario mentioned above.

Important: if users will input text for an answer, make sure that correct answers aren’t perceived as incorrect. Consider this code;

Ask Who was the 16th President

If ANSWER=Abe Lincoln, then SAY “Correct.”

Under this scenario, both “Lincoln” and “Abraham Lincoln” would be considered incorrect, as they do not match what is in the code.

Compound Conditionals

One could code this “Lincoln” OR “Abraham Lincoln”  OR “Abe Lincoln.” -- Still not ideal. It is best to make user input as simple as possible.

Data Validation/error capture

Example of data validation:

ASK “Type a number between 1-100.”

IF ANSWER is NOT > 0 AND < 101, SAY, “No silly. Type a number between 1-100.”

Work time

Reflection

Optional: Teacher creates a Google Form of the student-created rubric. Students use the form to evaluate their own projects as well as those of their peers.

.

“Gallery walk” - projects set-up on computers and then have kids move around the room trying things out.

Scratch Reference

Overview of Scratch

The Stage

Dimensions and Directions on the stage 480 by 360

Code Blocks

Stack blocks are code blocks with a notch at the top or a bump at the bottom. The notches and bumps serve as visual indicators that identify how the blocks can be snapped together to create programming logic.  The majority of code blocks provided by Scratch are stack blocks.

Hat blocks are code blocks with a rounded or curved top and a bump at the bottom, visually indicating that it can be snapped on top of other stack blocks. Hat blocks provide the ability to create event-driven scripts.

Reporter blocks is a code block that has either rounded or angled sides and is specifically designed as a mechanism for providing input for other code blocks to process.

Commenting

Comments within a script help the reader understand the Scratch program. It might also help the programmer later and/or if someone else tries to work with your scripts, she will be glad to see the scripts explained in comments.

Sprites

Concepts in Movement

Task 1: Construct an animation that causes the cat (or any sprite) to move 100 steps and then turn 90 degrees counterclockwise each time it is run (by clicking the green flag).

Variation: Have the cat draw a square, triangle, heptagon.

Where do Sprites come from?

Costumes and Costume changes (Absolute vs. Relative)

Change costume vs. Next Costume vs. Costume #

Editing costumes using paint and draw tools

Task 2: Make the cat and mouse run forever.

Conditionals: Forever and Forever if

Task 3: When the mouse touches the cat, the cat looks sad.

Adding Interactivity #1

Task 4: Move the cat move using the arrow keys.


Task 5: When the cat catches the mouse, the mouse says something and his appearance changes.

Intro to Variables

Task 6: Every time the cat catches the mouse, the mouse scores a point and the mouse loses 10 health points.

Communication between sprites: Broadcast & Receive

Task 7: When the when the cat touches the mouse three times, a new sprite appears on the stage and says, “ I am here to help.” Option: Change background

Variables and Text: The ASK command.

More with text: the JOIN Command.

Task 8: When the when the cat asks the user their name, he replies “Hello, ‘name.’ I am hungry for a mouse.'"

Animation with costume changes

Phase II Exploring the examples

Phase III: Advanced Concepts

Websites

Scratch Curriculum Guide

http://scratched.media.mit.edu/sites/default/files/CurriculumGuide-v20110923.pdf