The Richard Pate School Draft Year 4 Scheme of Work for Scratch Marcus Gilvear July 2014 (Acknowledgements: Phil Bagge and Duncan Hooper) Re Scratch: This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. 1
Scratch: Draft Scheme of Work for Year 4 Pupils in Computer Science Teaching and Learning Introduction Discussion Points: As in Year 3, reinforce the meaning of the terms Computer Science and Programming in the context of school: Computer Science is essentially a means to promote logical thinking and challenge pupils in the practical use of computer programming. Programming is a major part of Computer Science. It is when people create instructions using code on a computer to make something happen or achieve a desired outcome. Sets of instructions like this are known as algorithms. Within these algorithms, it is important to ensure that the steps are sequenced correctly for the desired outcome. You can use an everyday example to explain this concept e.g. making a cup of tea by boiling the water first etc. Hopefully, all of the pupils will have completed the Year 3 tasks successfully and will be able to grasp the basic principles involved with the gameplay of the Crab Maze; however, it might be worthwhile establishing what they already know about Scratch in a recap session; e.g. ask them the following questions: How can the keyboard be assigned as a source of inputs to the game? How can they make a sprite move? How can they edit a background for the stage? How can they change a sprite and make it smaller? Whilst discussing these questions you might wish to ask some of the pupils to demonstrate these actions on the whiteboard using Scratch. Next, load the finished crab maze which you have created (before the lesson*) and demonstrate the gameplay. *Before the lesson, you can create this Crab Maze by following the instructions under the heading Crab Maze from the very beginning (below) You can do this for yourself as a tutorial which you can subsequently show the pupils. This is an example of what a crab maze could look like and it can be created by the teacher by following the instructions further on in this scheme; it can then be saved and used as a demonstration. If you are new to Scratch, you will find it useful to run through the Year 3 task so that you become familiar with some of the basic operations. 2
Reminder: Decomposing is simply breaking a process or program down into smaller separate steps e.g. building a house is made up of different steps by laying the foundations, building the walls and putting on the roof etc. Explain to the pupils that this activity is slightly more difficult than the Year 3 tasks and remind them that debugging is simply finding errors within a sequence of events or code and putting them right for a desired end e.g. to make a computer-generated pen draw a square on the screen, the turns must be through right angles (90 degrees, not 45 or 60 etc.). The pupils will be expected to listen attentively as you demonstrate how to build the activity up; they will then be expected to reproduce the game themselves using the instructions and stages shown. This is an assessment activity which can be monitored in the classroom by the teacher whilst pupils work independently at the Scratch Stations. It is important for you not to help the pupils if they get stuck as debugging is part of the process in programming. It is worthwhile demonstrating the creation of the crab maze several times over several weeks to ensure that all the pupils grasp the concepts involved. You could switch between this document and Scratch as you go through the demonstration process with the pupils (by maximizing and minimizing the windows). The following table shows how to effectively monitor the progress of individual pupils in terms of skills and capability. Name: Date: Task 1. Task 2: Extension Tasks: Create a suitable maze with a start and finish point Make the crab look like it is opening and closing its claws Make the crab move when the game starts Make a start point for the maze Electrify the maze Fix (debug) any errors Make the crab appear to say Ouch! when it touches the edge of the maze Draw some coins that can be picked up by the crab increasing its score (use of variables and multiple sprites) Can explain (with examples) how to make a similar, but more complicated game Incorporate sounds (covered in the Year 5 SOW) Steer the crab using arrow keys Pupil A Yes yes Not quite -revisit Pupil B yes yes yes and so on In the vicinity of the Scratch Station, pupils can (where necessary) use screen shots to help them build the program (see last page). 3
Crab Maze- Starting at the very beginning: Open Scratch (Version 1.4) and point out Scratch the Cat (sprite) on the blank stage; say that it can be deleted and changed for something else e.g. a crab, like the one in the finished game you have already demonstrated. Click on the scissors icon (delete) button at the top of the screen and then click the sprite to delete it Scissors Icon (Delete Sprite) Next, point to the 3 icon buttons where it says New sprite and explain what is contained in each one, i.e. you can draw sprites, choose from a selection or have a surprise sprite; the one you need to click on is the Choose new sprite from file (middle button). Next, click on the Animals Folder and then choose and click on a crab to make it appear on the screen. In the Animals folder, scroll down and select the red crab sprite. You will see that it is too big to work with so, you can reduce the size of it using the shrink button. Click on a blank part of the screen to stop using the shrink tool. 4
Next, drag the crab to the bottom left hand corner like so: This is where your maze will start (however, you could choose another corner if you so wish). In this program you are going to create a crab with two costumes, one crab with its claws open, and one with its claws closed- by putting these two costumes together in a sequence, it gives the impression that the claws are opening and closing. You will notice that when you select this sprite (crab) the first costume is named crab1-a, but you need to click on Costumes to see this as shown below: Next, you need to click on Import and scroll down the pictures until you see crab1-b and then click on that- then you will see this: If you click on each of these alternately, you will see the crab claws belonging to the crab on the stage appear to open and shut 5
So, the concept here is that you have created two costumes, not two sprites. Important notes: Forever blocks represent a continuous repeating activity by the computer, e.g. to monitor for an event etc. within the program you wish to create, and this is called iteration in the field of computing; for Year 4 pupils, you can call it loops. If blocks can be used as the intervention to a forever loop when a specific event or condition is met within gameplay e.g. if the sprite were to touch a particular background colour, the game can be halted; this is called selection within the field of computing. So when using a forever and if combination of blocks, you are combining iteration with selection to achieve a specific task within the gameplay. Important: Iteration can also be called repetition, or, to make things easier for the pupils to understand, you can use the term loop or looping. Selection in terms of computing does not mean simply selecting something from a list, it means testing to see if a particular condition is true, and then doing something appropriate if it is. I will now show you how to create the script for the crab to open and close its claws when the Green Flag button has been clicked: These are the commands (blocks) that you need to drag into the Script area for the crab: You will need to click on the sprite (crab) first and then Scripts and then you can find these blocks in Control and Looks: 6
Now it is helpful to think about how you are going to join these blocks together (sequencing) to give the appearance of the crab continually opening and shutting its claws. Here is the answer, but it is best to try and encourage the pupils to work it out through discussion (usually best conducted on an interactive whiteboard) Once you have gone through the above demonstration, it would be good to see individual pupils achieve this stage of the task in the computer suite before moving on to the next stage; it is also an opportunity for you to understand the principles involved i.e. that the computer has no concept of time and action, other than that which you command it to perform for a reason. Try this: to make the claws appear to open and shut faster, you could type in 0.5 seconds in the 2 wait commands. Now let s think about game play- ideally, the crab needs to keep moving and you need to avoid the crab touching any electrified walls in order to get to the finish point. To achieve this, you need to be able to steer the crab up, down, left and right as it navigates the maze. You have already programmed the costume change for the crab, but you need to click on sprite now and select Scripts to get the crab moving. You will need to connect the following blocks which you have dragged from the Control and Motion commands: 7
As a teacher, you need to reinforce the concept that the computer will tell the crab to keep moving forward until you tell it to change direction by using some arrow keys. Also, when you connect the above 3 blocks and test it, you will see that the crab moves swiftly across the screen and disappears! So, what can you do to reduce the speed of movement? Answer: Type 1 step into the move box like so: You could even try 0.5 steps and be cross curricular with maths and decimals, also it makes the game easier to play as you will see. The next thing you need to do is introduce the concept of turning the crab through a small amount as it moves forward to point it in the direction you wish it to go. This can be achieved by assigning the arrow keys on the keyboard. You can do it with the following command blocks: You now know that the crab has already been programmed to move forwards and because you want to gradually change the direction of the crab either left or right you need to think about how to achieve this. Look at the following blocks which allow you to use the right arrow key on the keyboard to turn the sprite to the right or clockwise whilst it moves forwards around the stage: 8
Always test your program to see if it works. To recap, your Script area for the crab should look something like this: You can reinforce to the pupils that they can tidy up and move commands around to suit by dragging the groups of blocks around - not everyone s script area will look the same. Next, you need to create a change in direction which involves a turn to the left. If you look at the set of blocks below, you will see how this can be achieved by adding an extra if block and a left arrow key and anticlockwise (or left) turn of 15 degrees: Now test the control of your crab s movement around the screen using the left and right arrow. I think you will agree that to make it easier for gameplay the crab should forever move forward 0.5 steps instead of 1? Go back to your movement blocks (commands) and type in 0.5 instead of 1 step 9
To create or import your background for the maze you need to click on Backgrounds Pupils seem to enjoy choosing a background from the ones available as it adds a certain amount of authenticity to their game! Once you click on backgrounds, you can select Import to browse the backgrounds available: Click on the Nature folder. Scroll down the pictures and select the underwater scene Remind the pupils of how to identify and use a scroll bar. 10
You can reset the sprite at the start of each game by adding the go to x: y: block under the first set of commands you created (costume change), but don t forget to put the sprite in the start position before going into the Motion blocks to get the go to command. Your script area for the crab should look something like this: Now you can think about how to create a simple maze for the crab and an end-point to the game. I hope you have guessed that you now need to Edit the background!. 11
I am now going to stop using as many arrows as before to point things out as the terminology of Scratch should be sinking in by now? OK. You can now use the drawing tools to create a maze similar to this one: (I have used the line drawing feature near the colour palette to create my maze Oops! - Maybe too much information, as you need to start finding things out for yourself!) Notice that I have drawn a yellow spot (above) to signify the end point of the game. So let s recap: You know that the crab can be steered at a manageable rate around the screen and that you have also created a maze with an end point in the top right-hand corner. Oh dear, but wait- You might well end up with this when you press the green flag. This means that it is going to create a problem for your maze if you try to electrify it (as in the Year 3 Racetrack). There are a few ways to deal with this problem and it is a good discussion point to have with pupils. 12
I will show you an easy way to deal with this if you have not already thought of it That s right! Simply change the shade of colour in the start corner! Alternatively, you can put the sprite in more of an exact start point and get another go to command. By doing this, it means that this part of the maze will not be electrified because you will not select that colour in the forever if loop which you will create next. In this game, we will do something slightly differently to the Year 3 Racetrack, i.e. you will stop the game altogether if the crab touches the darker blue parts of the maze. If this makes sense then maybe you will have some idea of what to do next? Nearly all the pupils in your class will know how to solve this problem if they successfully electrified their racetracks in Year 3. Here is the answer, but see if you can work out how to create it yourself: You can see here that this script for the crab uses a forever and if block; if the sprite touches the maze at any point in gameplay, it will bring the game to a halt. At this point you have some ideas you can share with the pupils e.g. How could they make the crab say Ouch! when it touches the walls of the maze? Or, how can they make the game more interesting? Because you can see the speech bubbles created when a sprite talks, you need to go to the Looks commands. 13
Now you could create the end point of the game and think about what will happen when the crab gets to the yellow dot to signify the end of the maze. When the red crab touches the yellow dot (end point) you need to acknowledge that in some way. To achieve this, you need to apply the same kind of thinking you applied when electrifying the maze. This kind of logical thinking should result in the pupils (or you) being able to put these blocks together: Hint: think about what you want to achieve You want something to happen if something else happens! In this case, you want to see something happen on the screen by way of a speech bubble when the crab meets its goal- This means that you have to use the Looks commands The whole process of programming usually revolves around problem solving when questions are asked which can involve more than one answer or solution. In this case it is straight forward. As a discussion point (during demonstration) you need to find out who amongst the pupils in your class has grasped the concepts involved, as you will then begin to involve them in the teaching and learning experience to your advantage. If you are experiencing problems just go back to the beginning and start again. Test out your crazy crab to see if the game works so far as planned (or programmed). If you have managed to follow these instructions (by using the Year 3 Scheme of Work for reference) then well done! You do not have to teach in any more depth than this at Year 4! The extension tasks provide an opportunity for more-able pupils (in programming) to create all sorts of amazing things with their gameplay and this is something which you can observe and congratulate upon. I am sure that your more-able pupils will astound you as they add features to their mazes and they should be praised for doing so. It is important to reinforce that they must recreate the processes (blocks of commands) exactly as you have demonstrated in order for them to get a tick in the boxes on the assessment sheet adjacent to the Scratch Station in your classroom; this ensures that they have shown understanding of the principles/concepts met. So, for assessment purposes, the Scratch Station in the classroom provides an accurate way of assessing and monitoring each pupil s ability to successfully complete the tasks which you have set. 14
EXTENSION ACTIVITIES The gameplay can be made more competitive for pupils if they were to add a Variable such as a points system, whereby the crab collects points by catching coins as it moves through the maze. To enable the crab to gain a point and increase its score before reaching the end of the maze, you need to look at your options In this case, you want something to happen if something else happens, plus, you want to be able to keep a score if that certain something happens. In this screen, you can see that 10 gold coins have been drawn on the background to represent coins. This will not work If you want the coins to disappear as the crab grabs them, you will need to try something else, as once you have drawn something on a background it stays there unless you edit it. So how can you create some coins? This is a great activity for the more-able in computing as they will invariably show the teacher new things as they explain their algorithms! If you look at the following screen try to think about what has been added 15
That s correct! I have added a variable (Score counter) and 10 gold coin sprites. To create a points score counter (variable) you have to click on Variables and select Make a variable then type in the word score or (points if you prefer)- and click OK: You will then see the Score Counter appear on the Stage Don t forget to use the 2 commands necessary to reset your score counter when the green flag is pressed! (You can drag them into the scripts for the crab.) I will show you how to increase the crab s score by touching the coins once we have created them: The coins can be drawn by clicking on Paint new sprite. Once you have done this, you can create a gold coin sprite with the paint brush and choose an appropriate size of brush and colour. 16
Once you have done that, you can make 10 coin sprites in total by using the Stamp button to create more sprites. To achieve this, click on Stamp and then on the first coin sprite you have created and it will automatically create another one to the right in a row- You can repeat this until you have created 10 coin sprites. This is much quicker than trying to draw 10 individual sprites. When you create the coins, they might stack up on each other on the screen, so you need to drag them around a bit to position them where you want them in the maze. Now you need to think about how to make the coins disappear once the crab has touched them and also to increase the score (variable) by 1 point. More importantly, you need to get the pupils to think about how to create this in the scripts area with command blocks. If you click on the Looks scripts, you will see Show and Hide. To make the coins disappear when the crab touches them you need to use the Hide command - also, you need to increase the score by 1. In the first coin sprite script area, it s interesting to see if the pupils can come up with the following group of blocks: You will notice the use of both the show and hide commands; the reason for that being that when you start a new game, some or all of the coins from a previous game may have disappeared; so, by using the green flag and show commands, the coins will appear at the start of the game. 17
You could move the show command as shown below to simplify the script further: There is an easy way to copy this set of commands or scripts to the other sprites, and that is by simply dragging both sets across to the sprite icons- As you hover over each one the transfer happens by clicking off the mouse. Remember that Sprite 1 is the crab. Repeat dragging the commands from Sprite 2 s script area to the other sprites i.e. Sprite 3, 4, 5, 6 etc. 18
NB: If you do the script for one coin first and then test it out, when you duplicate it, the scripts get copied too, so there s no need to drag them over later; it s up to you which method you prefer to use. Now you are ready to play the game! Below are some screen shots which you may like to laminate and use as prompts if pupils struggle a bit. They show the main command blocks, but try and avoid simply letting them copy! If pupils need to rely on screen shots or teacher input to achieve the task, they should be encouraged to attempt the tasks at some stage later in the term, as repetition is the key. 19
Remember that the gold coins are sprites and that they need to be programmed with their own individual scripts. Below you will see that if the crab (sprite 1) touches the gold coin, (sprite 2), the coin will then be hidden from view. There are other ways of creating a crab maze with coins so it will be interesting to see what some of the more able programmers come up with. Remember that the teaching of Computer Science is a non-linear process which allows all concerned to develop at their own pace and level of ability. 20
21