Tag Archives: variables

Creating a countdown timer with year 5

Following on from last week, this week we are going to look at variables in more depth. You will have the chance to remind yourselves of what variables are and how you can add them to a game.

We will then look at how we can add more complex variables, such as a countdown timer, and make things happen as a result using conditional blocks.

To begin with we will use the same base project as last time:

Pong without scoring

Tip – for all instructions, think about when you want them to happen.

Mild: Create a timer variable and set time to 20

Medium: Use a wait block to and a change block to change the time:

Hot: Use an if/then conditional block (and others) to make something happen when the timer reaches zero.

Variables – week 2

Following on from last week, this week we are going to look at variables in more depth. You will have the chance to remind yourselves of what variables are and how you can add them to a game.

We will then look at how we can add more complex variables, such as a countdown timer, and make things happen as a result using conditional blocks.

To begin with we will use the same base project as last week:

Pong without scoring

**UPDATE**

Here’s Kaitlin, Chand and Emily’s project – not only did they get the timer working without any additional support, they also switched backgrounds with the background varying according to how the game ended. Click on the link to the project page to see how they it.

Can I add variables to a game in Scratch?

Last week we decomposed Scratch projects to find and fix errors in their code. This week we will focus on one particular project – Pong. The objective is to improve Pong by adding in a scoring system, and for some of you adding in a timer to limit the length of each game.

Decompose the game on your sheet in as much detail as you can.

To begin with you will need to plan exactly what you want your scoring system to do – think about these questions:
– How will you score points?
– How much will the score change by?
– When will the score need to change?

Pong game without scoring

Here are your challenges:

Mild – Add variables ‘score’ and ‘time’ to a game

Medium – improve the game by introducing a score which increases as you play and resets at the beginning of each game

Hot – Add a countdown timer to your game

Extra Hot – End your game when the timer counts down to zero

On your prompt sheets are some of the blocks you will need, and some that you won’t…

Sonic Pi – week 2

LO: Can I apply programming skills to coding in Sonic Pi?

I can sequence instructions in an algorithm to create sounds
I can change variables in an algorithm to make a tune more recognisable
I can use loops and repeats to make my algorithm more efficient

Last week we looked at making sounds with code using Sonic Pi. We used the ‘play’ command combined with midi note numbers to create notes and chords. As you can see on the examples below, some of us managed to combine notes to create a recognisable tune.

This week we will develop our skills by using three key concepts of programming:

– Sequencing (mild chilli challenge)
– Variables (medium chilli challenge)
– Loops (hot chilli challenge)