Consider making a bowl of cereal. What are the specific steps to make a bowl of cereal? Who might be receiving the instructions?
When programming a computer, the computer needs a human to give it specific instructions in order for it to perform a task.
On block based visual programming apps and websites like Scratch, you are writing instructions for the SPRITE.
When creating a new program on Scratch, the CAT will be the sprite that you are commanding unless you change it to a different sprite.
Depending on what you want to create on the stage, you might have more than one sprite and may be programming multiple sprites so they interact.
Sprites can be edited by changing their costumes, the size, the location, or direction that it is facing.
Sometimes a program does not require a visual sprite on the stage. The sprite can be hidden by the click of a button so a program can run and not be obstructed by a visual sprite.
Sequences are the step by step instructions (aka the code, the program, the script, the algorithm)
In block based programs, you snap together different blocks to create ordered steps. The computer reads the instructions from top to bottom.
When you RUN the program, the sprite will perform the steps on the STAGE.
The stage can be changed by adding a BACKDROP, switching to a different backdrop as the program runs, or editing the backdrop.
There are many different blocks in Scratch. This first group of blocks are essential for creating simple programs that move a sprite or sprites, modify a sprite or get a sprite to say or speak. Let's learn about a few different types of blocks and then begin creating our own programs.
Note: If you choose to begin with Scratch Jr app on an ipad, the blocks will be similar to those outlined below; as a result, coding assignments below could be completed on Scratch Jr.
Your program must start with a yellow event block so the program knows when to run.
There are multiple event blocks to choose from.
When you are creating a program, you may have multiple events happening (multiple scripts on the coding pane). For example, you might run your main program/script by clicking on the green flag (this is event 1), but then you want to erase or reset what is on the stage before you run the main program again. This can be done by clicking on the space bar which has its own program that erases or resets the stage (this is event 2). By using multiple event blocks you can control when different programs run and when creating a game, these different events help to create game controllers.
These blue blocks move your sprite in different directions and by different magnitudes. Sprites can move either by the number of steps taken in a specific direction or by using coordinates. There is a grid backdrop to help with selecting coordinates.
These blocks control the script and can make your program more efficient. You can pause the program using the WAIT block, repeat instructions using LOOPS, and make something happen if a condition is met by using conditional statements with boolean operators (green hexagon blocks).
The purple blocks allow you to add speech bubbles (words) to the stage, to switch the costume of the sprite or switch the backdrop, to change the size or colour of the sprite, and to hide the sprite.
The pink blocks allow you to add sound to your program. You can even record your own sound.
Go to Scratch website. Join Scratch by creating a username and password or sign in.
Click on Create to make a new program. Change the title to "my first program".
Change the cat sprite to a person sprite.
Change the backdrop from white to a field.
Create a program that makes the person move from left to right across the field. Each time the person should start on the left and move to the right. When the person stops, they say "Hi! I'm ..."
This program involves sequential events because the sprite moves forward and then says something. This coding concept is included in the grade 1 ON mathematics curriculum.
CODING TIP: As you create a program, run your program often to ensure it does what you want and so you can see what you need to add. Debugging is process of finding errors in your program and correcting them. Running a program regularly helps to debug your programs.
Let's continue to add to this program.
4. Add a soccer ball sprite. There are now two sprites that can each be programmed to run at the same time (in parallel). These would be concurrent events (2 or more events happening at the same time). This coding concept is included in the grade 2 ON mathematics curriculum.
5. Edit the program so it looks like the person moves towards the ball and then kicks the soccer ball. You will have to program both the person and the ball and use wait blocks to ensure correct timing.
CODING TIPS: Remove blocks from the coding pane by dragging the blocks to the left towards the different blocks.
Right click on a block or groups of blocks to duplicate, delete or add comments to blocks. Duplication of blocks is faster than searching for the necessary blocks in the blocks list.
It's time to add a loop that repeats an action to our program. This coding concept is called repeating loops and is part of the grade 3 ON mathematics curriculum.
6. Edit the program so that the girl dribbles the ball across the stage. Dribbling in soccer is when the person moves the ball down the field with the repetitive action of light touches on the ball.
Let's create a program with nested events which is a loop within a loop. This coding concept is part of the grade 4 ON mathematics curriculum.
7. Edit the program so the girl dribbles the ball down the field and then kicks it back to the original position and chases after it. She repeats this drill a couple times.
This is a Scratch program to use as a guide when creating your program.
Here are some other activities that you might like to try before you move onto new learning.
Create a program that
has the sun rising in the east and setting in the west. Once the sun has set, a moon appears. Switch the backdrop from day to night. Make the actions repeat.
has a person stand in place bouncing a ball 4 times then takes a free throw shot. They repeat these actions 5 times.
has a person dribbling a ball down the court and takes a shot.
has a repetitive action with two or more sprite interacting.
Now that you understand what coding is, what some of the coding concepts are, and what some of the different blocks do, it's time to learn new blocks so we can incorporate coding into the science and mathematics classroom. Click on the button to continue to the next coding learning experience.
Ontario. Ministry of Education. (2020). Ontario Elementary Math Curriculum. Retrieved from https://www.dcp.edu.gov.on.ca/en/curriculum/elementary-mathematics/grades/g1-math/strands