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.

 

 

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.