Pages

28.4.10

Making and Playing Computer Games With Scratch Episode 1

A while back I found myself downloading and playing with scratch, considering it as a possible tool to complement work I was already doing with Phase 2 students around Shape and Space and LOGO.  With a move to work with Phase 3 students I have been "encouraged" into the slightly steeper learning curve of using Scratch as a programming platform in its wider sense, resulting this term in a series of sessions exploring arcade games and working with students to use the tool as a basis for designing, making and evaluating one or two of our own.  I have decided however, as an offshoot of this and to support my personal professional learning to use some of the materials from Phase 3 sessions with my phase 2 ICT club as well, and to see how they got on.  Our first session worked really well, and I was impressed at how creative some of the younger students were with the basic scripts in hand.

The first Session involved students familiarising themselves with the layout of the tool's interface.  Following given instructions and scripts to bring about increasingly complex animation effects. Within the session students used the default "sprite" initially and blocks from the control, motion and looks scripts areas only to bring about 3 different types of animation.
  • Activity one bringing about movement as a flip in position using an on mouse click event.
  • Activity two bringing about continuous movement of the sprite from one side of the stage to another, with an image swap to add interest to the sprite's actions and a change of direction when it reached the edge of the screen.
  • Activity 3 using four separate scripts, that on click or use of a keystroke would allow user control of the sprite to move it around the stage using the up, down, left and right keys on the keyboard.
 Within the session the following scripts were were provided for students to use.

Activity 1
As the students worked with the above script they discovered that the sprite didn't simply flip, but rather rotated as it changed direction.  The students were encouraged therefore to explore what would happen if... they changed the settings of the motion buttons highlighted in the image above.  Could they
  • make the sprite mirror as it turned
  • stand on its head 
  • step forward and back?

Activity 2

Running this script, the sprite walks back and forward across the stage when the green flag is clicked, its moevement repeated because of the forever loop until the red stop button is pressed.  Again in running this script students were asked to explore the effects of changing the position of the motion buttons, but in addition to explore what would happen if we altered some of the variables in the motion blocks.
  • Could we slow down the sprite?  
  • Could we speed it up?  
  • Could we make the sprite's speed vary so during some parts of the routine the sprite seemed to be moving faster than at others?  
  • How did our changes effect the way he/she looked as they moved?  

What would happen if...

we changed the green flag header block for the

"when [something] key pressed,"

or "when sprite clicked"

header blocks.



Activity 3

Here students were encouraged to recreate a script that would enable them to control the sprite using the arrow keys, so that for example when the right arrow key is pressed and held down the sprite walks towards the right side of the stage. This example with the addition of a cap block will bring about movement towards the bottom of the stage by the sprite when the down arrow key is pressed.


Having completed one of the scripts the students were shown how to duplicate it and then how to edit the values according to given models values in the images below.  The addition of green flag caps to the procedures, meant that on clicking the green flag the program would run, allowing the students to control the sprite's movement across the stage in the up. down, left and right directions.  In effect they could take the sprite for a walk.

These were then tested to ensure that they worked, and then further edited if need be to correct them.


To engage the students in evaluating this Focussed Practical Task, they were asked...  If we were making a computer game of our own...
How might this set of procedures be useful
Where might we use them, and what might be happening in our game?
Following discussion several familiar gaming type scenarios arose
  • Perhaps we might want to move our character around a room, perhaps colecting things.
  • Perhaps we might want to move our character around a maze.
What seemed to excite the students most however was that they now had a working model that they could explore and play with, and this lead to our extension activity... 


Extension


Having copied the scripts and set a scene where the sprite could be moved with the keyboard the students now wanted to play with what they had done..
  • Could they change the sprite or character they were animating?
  • Could they set a scene for the character or sprites actions to happen in?
With the model in place the students 
    • explored importing new sprites to replace the cat. 
    • investigating how they could get their new sprite to follow the instructions they created for the cat.
    • Adding an extra sprite and having it move using one of our earlier scripts at the same time as the original sprite.
    • Editing, recolouring and changing the sprites they had imported.
    • Importing image backgrounds from collection or from the web as well as creating background images  providing context to the action.
    The session created a great deal of excitement and raised towards the end an important question we need to address if we are to make a game of our own such as.. 
    • How do we get the characters to do things when they meet or bump into each other?  
    • How do we get sprites to interact with each other?..

    This seems right now a good place to stop.. As it was with the students... Leaving them with a cliff hanger and waning more next time, when I have promised them with this as the prerequisite scene setter, that during our next set of activities involving the use of "sensing blocks,"  we wil be creating a very simple game a "keepy uppy type" game.  This will involve creating a "paddle" and "bouncing ball" the first steps in creating our own versions of "breakout."  Hope you drop by for our next installment.