Tag Archives: scratch

Design a Coding Unit for the Classroom

STEM learning objectives are being included in many school, district, and national curriculum standards. As a result, educators are challenged with creating engaging and challenging instructional materials to teach computer science skills. But most teachers don’t have a technology background, much less knowledge of programming. Here’s some help. Whether you’re using ScratchJr, Scratch, HTML and CSS, or Python and the Turtle Library, the activities will be similar. Following are some basic strategies to consider when you start to design a coding unit for the classroom.

Practice Sequencing Algorithms Offline

Design a coding unit to include offline exercises. This will develop computational thinking. A starting point for instruction is to build algorithms. An algortithm is a description of the program. It uses words and symbols to sequence the instructions.

The logical order of coded instructions is critical. To build this skill, instruct students to physically act out and order a list of directions in simple, everyday language first. For example, if a programmer had to write a program for the task of putting a piece of paper into the trash, it may have the steps:

design a coding unit

Have students act out the steps they listed to check them. Or, have a list of mixed up steps that students must unscramble to place them in the correct order.

Start Simple

When you design a coding unit, move from simple to more complex code slowly.

Don’t offer a complete set of instructions in code and have the students copy it and run it to see the result. This may intimidate young programmers and even make them think that coding is too difficult. Moreover, they won’t learn what each part of the code does.

Instead, write a few lines. Then test the result. The instant response will create a connection between the coding and its function.

coding for kids

In TechnoWhiz, primary students are introduced to ScratchJr by using one block at a time to move the character on the stage. They observe the resulting motion. Then they combine a series of blocks to create a script and see the effect. Next, they add more characters and move them, and learn to loop their actions. By the end of the project, they are able to make an interactive, one-of-a-kind racing game with a background, formatted text, and characters moving at different speeds, dancing, and talking!

Use Trial and Error

Invite students to experiment with values to figure out what works. Try a number or value. Does it need to be higher or lower? Test often to see what works.

Encourage exploration. For example, when using Python and the Turtle Library, circle(50) draws a circle with a specific size. Students can explore by changing the number to a higher value and a lower one. Or code left(90) to turn the turtle symbol. Then change the value to see what angles the turtle turns. The repeated experimentation will result in learning that can be applied in subsequent activities.

Teach Debugging

Don’t wait until mistakes are made. Early in the project, create errors with intention. Have students ‘break‘ the script, then fix it. As a result, they will recognize mistakes that may be made later in their own programming and be more likely to correct them independently.

design a coding unit

Apply Skills

Introduce a skill, repeat or review it, and then transfer it to another application using the program. Avoid teaching a concept in isolation. When students re-use skills in different contexts, they will accumulate their knowledge and be able to apply it in their own creative projects.

teaching coding to kids

For example, in TechnoTurtle students learn to use Python to control the movement of a turtle symbol. Then they apply their skills to write scripts to draw pictures and to move the turtle through a maze. In other parts of the project, they learn about variables. Then they use this concept to create Mad Libs and to produce an interactive carnival game.

Show Samples

Demonstrate how a completed project might look at the beginning of a lesson. This will serve multiple purposes: students will have a clear idea of what they’re making, they will be inspired to create their own unique version, and the sample can be a coding reference guide to use if trouble shooting is needed.

In TechnoHTML, a sample web page about skateboarding sparks student interest and demonstrates the skills they will learn using HTML and CSS:

design a coding unit

  • Formatting text
  • Adding images
  • Making lists
  • Linking to sites

Provide an Opportunity to Share

At the completion of the project, ensure that students have an authentic audience. This helps students to connect their work in the classroom to the real world and see a purpose for their efforts. Their peers are a perfect audience. Celebrate the finished projects and encourage interaction and feedback. The digital nature of programming projects makes it easier than ever to share work with classmates, family, and friends.

design a coding unit

For example, in TechnoCode, middle school students place their collection of completed animated scenes, stories, mazes, and games into an Activity Studio to share with others.

Then they invite feedback and recommendations for improvements.

Reflect on Learning

Finally, give students an opportunity to reflect on their experiences in learning to code. In either written form in a journal or as a class discussion, ask:

  1. What did you like about learning to program?
  2. Is there anything in your project that you would like to change?
  3. What do you wish you knew how to do?
  4. Have you learned anything about yourself?
  5. What advice would you give to a beginner programmer?

design a coding unit

In TechnoTales, students in grades 2 to 5 use five simple reflection responses to gain some insight into their learning.

The young programmers used Scratch to design a story with four scenes, multiple animated characters, a plot with a dilemma to solve, and a happy ending!

Design a Coding Unit

TechnoKids has elementary and middle school programming projects for Scratch Jr, Scratch, Python and the Turtle Library, and HTML. Before starting to design a coding unit of your own, try one! Visit the TechnoKids online store.

design a coding unit

TechnoKids has programming projects to teach ScratchJr, Scratch, Python, and HTML and CSS

Teaching If Then Statements, Make Real World Connections

Make real world connections when teaching if then statements to beginners. If then statements are conditionals. A conditional is an action that occurs if something specific happens. If then statements are used in programming to trigger a set of instructions.

teaching if then statements

Before learning how to code if then statements, students need to understand the logic.

If then statements can be a difficult concept for young children to understand. To help them comprehend the logic, compare it to situations in their daily life. For instance, you may go home from school but only if it is the end of the day – then you can leave. Or you may get a treat, but only if you eat your dinner – then you can have a cookie.

Teaching If Then Statements to Beginners

Think about a school day. IF an event occurs THEN what happens?

  • if it is math class then ___
  • if it is library day then ___
  • if the fire alarm rings then ___
  • if the teacher is talking then ___

Think about a sporting event. IF an event occurs THEN what happens?

  • if the referee blows the whistle then ___
  • if a time limit is reached then ___
  • if a racer crosses the finish line first then ___
  • if a player touches a friend during tag then ___
  • if a soccer ball goes out of bounds then ___

Think about weather. IF an event occurs THEN what happens?

  • if it is hot then wear ___
  • if it is cold then wear ___
  • if it is rainy then wear___

Think about your daily life. IF an event occurs THEN what happens?

  • if the clock alarm goes off in the morning then ___
  • if you do not clean your room then ___
  • if the traffic light is red then ___

Think about gadgets. IF an event occurs THEN what happens?

  • if a cell phone battery charge is 0 then ___
  • if a person forgets to sign out of a device then ___
  • if the microwave reaches the time set for cooking then ___
  • if the SHIFT key is pressed when typing a letter then ___
  • if the Fill tool is clicked by the mouse in a drawing program then ___

Teaching If Then Statements using Scratch

When teaching if then statements it is essential that students understand the logic FIRST – before programming begins. Once connections have been made to daily life, students are ready to build scripts with if then coding statements. The if then coding block in Scratch, a coding app for children, can be used to direct the action in animated scenes, puzzles, or games. It uses blocks that are joined together to form scripts. The if then coding block has a blank spot that is filled with the condition.

if then coding block in Scratch

if then coding block in Scratch

In Scratch the if then condition can be:

  • if a sprite is touching another sprite
  • if a sprite touches the mouse pointer
  • if a sprite reaches the edge of the stage
  • if a sprite touches a color
  • if one color is touching another color
  • if a keyboard key is pressed
  • if the mouse button is pressed down
  • if a value equals an amount
  • if a value is less than an amount
  • if a value is greater than an amount

Lessons to Teach If Then Statements

Are you interested in teaching a coding unit that applies if then logic? TechnoCode uses if then statements to have students build scripts to control the action of characters. Several assignments use conditionals:

  • Animated Fish Tank: Sense if a sprite is touching a specific fish. If it is, then alter movement. Children can program the sprite to swim to a new spot, change direction, or spin.
  • Maze: Sense if a sprite touches a color outside the path. If it is, then move back to stay inside the path.
  • Game: Sense if a player touches a target. If it does, then increase the score.
  • Game: Determine if a final score in a game is greater than a value. If it is, then display a message such as “You won!”


How to Create a Timer in Scratch, Game Design

Want to know how to create a timer in Scratch to set a time limit for a game? Follow the instructions to create a counter that tracks each second that passes. When a specific time is reached, the timer stops counting and the game ends.

create a timer in Scratch

Create a timer in Scratch to set a time limit for a game.

About the Scripts and Your Game

The directions listed below explain how to add a timer to an existing Scratch project. You may need to adjust the scripts slightly to suit your game.

About the Timer Variable

The script requires the use of a variable. A variable is a factor that can change. Create a timer variable. It will be used to hold the number of seconds.

Scratch Coding Blocks Used to Create a Timer

Scratch has several coding blocks that you will use to build the script:

change my variable by 1 Increase the (timer) variable by a specified amount.
Reset the (timer) variable to zero when a new game begins.
Display the timer variable to see the counter.
repeat until Do an action until the something specific happens (time limit is reached).
An operator that tests if the first value (seconds that have passed) equals the second value (time limit).

About the Timer Script

Before making the variable and building the script it is important to understand how the timer script works. Study the script below.

Does the timer equal 15? If no, wait 1 second and then increase the timer by 1 second. Repeat until the timer equals 15.

Code used to create a timer in Scratch.

Code used to create a timer in Scratch.

Game Design with a Timer Video

Watch the video to understand how a timer can be used to set a time limit for a game. If this is a coding project that you would like to make, TechnoCode has a game design coding unit. The instructions explain how to build scripts to have a player touch targets to earn points. The lessons also include a planning sheet, game consultant checklist, coding journal log, Scratch quiz, and marking sheet.

How to Create a Timer in Scratch

Create a Timer Variable

  1. Open the saved game project in Scratch.
  2. Select the sprite that you will use to track the time (it might be the player).
  3. From the Variables palette, click Make a Variable.
  4. Type timer as the variable name. Click OK.
  5. Create a timer variable.

    Create a timer variable.

  6. Select the timer variable to display it.
  7. Use your skills to build this script:
    How do you want the script to start? Notice that in the sample script below, it begins with when I receive play game. This is a broadcasted message that you may have already created. If the broadcast message was not made, you can use the when Go clicked Hat block. To learn about broadcasting read the post, How to Broadcast a Message in Scratch.
  8. Set the time limit using an Operator block.

    Set the time limit using an Operator block.

    Tip to Setting the Operator Coding Block:

    • View the Operator palette.
    • Drag __=50 into the if-then block if-then.
    • Edit the number of seconds to the time limit. For example, 15.
    • View the Variable palette. Add the timer. timer

    Test the Timer

  9. Play the game. When done, click Stop.
    • Does the timer increase when one second passes?
    • Does the timer stop when it reaches the time limit?

    Set the Timer to Zero When a New Game Begins

  10. Play the game again. Does the timer start at zero? NO, it doesn’t.
  11. Select the sprite that tracks the time.
  12. From the Variables palette, add set my variable to 0 to the start of a script. Click the Variable arrow and select timer.
  13. Add a coding block to reset the timer.

    Add a coding block to reset the timer.

    WHERE SHOULD THE CODING BLOCK GO? Notice where the set timer to 0 block is located in the script above. It was placed after the when Go clicked Hat block of an existing script. Look at your scripts. Where should it be placed in your game?

  14. Play the game again. The timer should start at 0.

Programming Lessons – Coding Units

Interested in Scratch lessons? Learn more about TechnoCode published by TechnoKids Inc. TechnoCode is a technology project that includes a teacher guide, workbook, and resource files. Use the instructional materials to teach a coding unit to students in Grades 6-9.


TechnoCode lessons

How to Keep Score in Scratch, Game Design

Do you need to keep score in Scratch? If yes, keep reading! The instructions explain how to track the points earned by a player each time it touches a target.

Keep score in Scratch

Keep score in Scratch

About the Game

The directions listed below explain how to add scoring to an existing Scratch project. The game should have with a player and target sprite. Several scripts must already be built. For example, the player should have a script that controls its movement using the mouse pointer. As well, the target should be programmed to show in random spots. If your game design is different, you may need to adjust the scoring system to suit your Scratch project.

NOTE: These instructions are modified from the technology project TechnoCode, published by TechnoKids Inc. TechnoCode has programming activities for kids. The lessons include a game design coding unit. The seven assignments, guide students step-by-step through how to construct an entire game. To support learning, the unit has a planning sheet, example videos, sample scripts, programming challenges, game consultant checklist, coding journal log, Scratch quiz, Treasure Hunt skill review, and Variable extension activity.

About the Score Variable

The script you will build requires the use of a variable. A variable is a factor that can change. You will create a score variable. It will be used to hold the number of points.

A coding block will be used to increase the score by a specified number of points. Increase the score by 1

Another coding block will reset the score variable to zero when a new game begins.reset the variable

About the Scoring System Script

Before making the variable and building the script it is important to understand how the scoring system script works. Study the script below.

Is the player touching the target? If yes, then increase the score by 2 points.

score script in Scratch

Code used to change the score in Scratch.

How to Keep Score in Scratch

Keep Track of the Score

  1. Open your saved game project in Scratch.
  2. Select the player sprite.
  3. From the Variables palette, click Make a Variable.
  4. Type score as the variable name. Click OK.
  5. new variable

    Create a score variable.

  6. Select the score variable to display it. score variable
  7. Use your skills to build this script.
    How do you want the script to start? Notice that in the sample script below, it begins with when I receive play game. This is a broadcasted message that you may have already created. If the broadcast message was not made, you can use the when Go clicked Hat block.
  8. Scratch scoring script.

    Set the number of points the player earns each time it touches the target.

    Tip to Setting the Sensor Coding Block:

    • View the Sensing palette.
    • Drag touching mouse pointer touching mouse pointer into the if-then block if-then.
    • Click the arrow and select the name of the target.

    Test the Scoring System

  9. Play the game. When done, click Stop.
    • Does the score increase each time the target is touched?
    • Are too many points added when the player touches a target?


  10. Use these tips to improve how the player scores points:
    • If too many points are added when target touched, add wait 1 seconds after change score.
    • Play a sound when the target is touched. You may need to trim the clip.

    Set the Score to Zero When a New Game Begins

  11. Play the game again. Does the score start at zero? NO, it doesn’t.
  12. Select the player sprite.
  13. From the Variables palette, add set my variable to 0 to the start of the player’s script. Click the Variable arrow and select score.
  14. Add a coding block with the score variable to reset the points.

    WHERE SHOULD THE CODING BLOCK GO? Notice where the set score to 0 block is located in the script above. It was placed after the when Go clicked Hat block of an existing script. Look at your scripts. Where should it be placed in your game?

  15. Play the game again. The score should start at O.