Making games in Scratch

Once we had the hang of programming things to move, and added appropriate sound effects such as ‘aaghs!’ when a shark bit a fish, or of the bubbles in the tank, we moved on to control the fish in the tank rather than just have them swimming randomly.

Damian and AzizJames

We set the crab to work by telling it to point at the mouse then move five steps. This has the effect of making the fish chase the mouse cursor, so we could keep it away from the shark by moving the cursor around the screen.

Next we introduced the idea of controlling sprites (the name for the things in a game you can program) using the keyboard. To do this we created a new game using a racing car, although we could have used the fish, perhaps having the shark moved with arrow keys and the crab with the mouse then playing against each other to see how long the crab could survive.

We began by drawing a racing circuit then importing a car sprite.

Nishat car race

This is Nishat’s very colourful race track.

Once we had programmed the arrow keys to control the direction of the car we could get it to move around the track.

Aziz

Aziz introduced three different cars all steered by different sets of keys so that people could have a race.

Jack, Damian Aziz

We also learnt how to make the car go back to the start if it crashed. To do this we found the co-ordinates of the starting point then told the sprite that if it touched the colour of the outer edge it had to go back to that point.

It didn’t take long before we were all racing each other around the screens.

 

Diving into Scratch

What a busy morning. A lot of hardwork, but a lot of fun, too, and plenty of challenges.

We began with looking at the steps of a line dance and how instead of talking through each movement they give a sequence of steps one name. So a ‘link’ is putting a foot to one side, crossing the other one behind it, then moving the first foot sideways again, before bringing up the second foot to meet it. A lot easier to say “Do a link,” than to run through that sequence of commands each time. And you can use it again and again in different dances. In fact every dance is a collection of these sets of steps. A bit like coding where you bring together sets of instructions rather than having to rewrite the code every time.

We put this into practice in http://studio.code.org where we used the activities based on the film Frozen. These started out fairly easy, then we had to join them together to make ever more complicated shapes, like snowflakes and linked circles.

Frozen coding with Anna

Then we put into practice what we had learned from the simulated coding environment in code.org  by coding for real in Scratch. Some people  hadn’t used it before, but everyone got to grips with it very quickly.

After a quick tour of the coding screen the task was to create a fish tank, put a fish in it, then get it to swim backwards and forwards.

Scratch fish tank

We had to use the ‘Forever’ command and get the fish to ‘bounce’ whenever it hit the sides, so it ended up swimming around the tank. At the end everyone was adding more fish and getting them to swim colourfully around together.

 

 

Dance till you drop

We spent a lot of time this week dancing.

We watched videos of Dance Dance Revolution, a game involving a dance mat that most of the adults remembered, but not many of the students. You have to follow directions on screen to move on a floormat, scoring points if you tread on the right square.

We also watched a video of a robot and decided that Dance Dance Revolution was like programming a robot, so we created our own dance programs. In groups we created short routines using simple sets of directions and numbers, then we tried them out to La Vida Loca, before joining them all together into one long dance. Aziz acted as our choreographer helping everyone to follow the steps in each program.

Whilst the commands were the same in each dance – Fd, BK, Lt,Rt, Wait and Repeat – the number of steps or time to pause changed in each routine. These we called “Variables” because they change whilst the actions remain the same. We also introduced a command “Repeat until the music stops,” to make sure the dance lasted as long as the tune.

After that we used Purplemash and completed the Bubbles activity.

bubbles

As the bubbles drifted up the screen we had to click on them to make them disappear with a ‘pop.’ Some people added more bubbles and made them do other things, either changing direction or making different sounds.

Everyone thought it was a good fun morning.

 

Drag till we drop coding

Today we started using drag and drop to code. This way you  don’t need to type in the instructions but select the ones you want then join them together to build up the instructions.

We began by using a floormat and giving each other instructions to move around it. We had typed commands that we then added in numbers of steps or turns to. This could prove challenging remembering which way to turn.

Then we used the Angry Birds game in studio.code.org .

Angry birds in studio code

Next we used 2Code in Purplemash. We had to give fish in an on-screen aquarium commands to make them move in the right direction.

fish tank 1

We all got to the point where we could add our own fish then program them to move when they were clicked. You could add as many fish as you wanted to. Nishat wanted to add a lot of fish.

nishat fish tank

She must like clown fish!

Some of them moved automatically. Others had to be clicked on to start them moving. We found you could click one fish and make a different one move.

Sometimes we had to think very hard to work out what to do. But everyone worked hard.

More steps in programming.

 

Robots are machines that we can tell what to do and that will do that thing again and again and again, whenever we want them to. Rather like washing machines or microwaves. These have programs that perform the same function whenever we set them to do a particular thing. We talked about examples of this in the world around us and thought about traffic lights.

The first challenge this morning was to work out the sequence that traffic lights followed. Students used coloured discs to act out what traffic lights do. We watched a very boring video of a set of traffic lights and realised that the timing of each light varies. We then wrote a program for a set of traffic lights.

Repeat continuously:-

Red on 20 seconds

Red and orange on 2 seconds.

Red and orange off.

Green on 14 seconds.

Green off.

Orange on 4 seconds

Orange off.

We tried following this sequence with a set of three coloured torches, red, orange and green. It was harder to do than it looks.

We then moved on to programming on screen. The program 2Go is part of Purplemash from 2Simple. It has different sets of tools in it that mean programming with it can become more and more challenging.

At first we used buttons to move in a particular direction. Then we added a set of boxes, a flow chart, to program in.

Then we added diagonals . The next challenge was to program a turtle to write a letter from our names using diagonals.

A letter F programmed in 2Go.

‘F’ for Fatima.

Fatima didn’t need to use diagonals for her letter.

To work out the programs we wrote letters on graph paper then worked out the directions and the steps.

A letter N created in 2Go.

‘N’ for Nowrin programmed in 2Go.

Nowrin needed one diagonal. She needed several attempts to get it to be the correct length.

A letter T drawn in 2Go.

Tasmima’s letter T

Tasmima’s letter ‘T’ has four steps in the progam.

A letter W drawn in 2GO

How to program a ‘W’ in 2Go.

Wasima programmed her ‘W’ quite quickly. She was pleased with what she had done.

There were lots of challenges. Nishat needed to use the whole flowchart of 10 steps to create an ‘S.’ Jack did a ‘J’ that filled the screen, and James managed to write his whole name.

Everyone worked hard, but they all enjoyed it.

We Robot!

One way we use programming is to control electronic devices, such as microwaves and dishwashers. It is also how we tell robots what we want them to do. Some robots are like in films. They look like mechanical human beings. Others are machines that work in factories doing jobs where the same thing has to be repeated in exactly the same way time and time again.

We began the lesson with a sheet of 2×2 grids. The students had to work out how many different paths they could find along the lines to get from one corner to another. We then wrote these out as instructions using Forward, Left and Right. Some of the students gave a number of degrees to turn by. One route was:-

Forward 1

Right 90

Forward 2

Left 90

Forward 1

Next we marked out grids on the floor with masking tape and tried out our instructions, taking it in turns to be robots being programmed. It was sometimes hard to use the correct words, and to ignore the wrong ones.

There were also some more complex routes involving diagonal lines so we had to work out that half a turn was 45 degrees.

We had a short break then tried out what we had learned on some ‘real’ robots.

IMG_1486

This is Ritchie the Robot. He works by remote control. He is only a toy really, but he moves and turns when you press the keys. It could be quite hard to get him to go to where we wanted him. It was easier if you stood behind him. We couldn’t really program him.

This robot is  a Bluebot. You program him by pressing a sequence of buttons on the top then pressing the ‘Go’ button in the middle.

???????????????????????????????

He would follow the same route every time because the instructions didn’t change – just like a real robot.

Some of us also tried out the Beebot app to make him go follow the correct path on an iPad.

 

First steps in programming

Students from Langdon Park and Mulberry Schools are starting a ten week course in computer programming. To get started we thought about sequences and putting things in a logical, regular order that is always the same. Like you have to do in Line Up from Busythings. The Langdon Park group picked this up very quickly and took it in turns to put in the correct answer. The problems got harder using more colours and shapes, and changing the spaces that needed to be filled.

line up

Once they had that cracked we moved on to an activity needing logical thinking. In Block-a-doodle-doo you have to move vehicles out of the path of the chicken in the green car who is the worst driver ever, carrying on in a straight line, banging into things, and expecting everyone to get out of the way. If the monster on the motorbike catches the chicken he eats him.

Block a doodle doo

We talked about sequences in everyday life, things we do regularly without even realising we are following the same set of actions every time, like when we cross the road.

We went on to program a chicken to move through a maze picking up jewels on the way and avoiding monsters in Path Peril. This got harder and harder until there were five jewels and three monsters and no way to avoid them except by timing your moves right. It brought lots of laughs as the chicken got grabbed, gobbled and blown up.

Path peril

For the final activity we use J2Code and found the parking problem. Here a sequence of instructions is coded into a program to move a car from one parking bay to another. We watched as each line of code was run through then added and deleted lines to debug. We left the car park with several damaged cars!

j2eturtleparking

 

In our second session a week later we transformed one of our teachers into a Human Robot who only understood clear instructions: “Forward (x)” “Backward (x)” and “Turn right”, “Turn left” where X is the number of steps we wanted the robot to take. We had fun making the robot travel round the room and then describe some shapes.

Then we programmed the Mole to get the worm in the TES iboard activity Mole Maze  We made it move one step at a time, then made a list of all the instructions before pressing Go.  Remembering right and left was a bit tricky for some, especially when the Mole was facing downwards. We spent a very little bit of time remembering why we had to put “90” for a right angle, “180” for a half turn etc.

mole maze This activity comes with three levels and we all started on the easy level first.

We logged onto Purple Mash and used 2Go to programme some letters and other shapes. jack