1 Cover Lesson for Scratch Mr Dougall Scratch guide to Pacman

1
Cover Lesson for Scratch
Mr Dougall
Scratch guide to Pacman extra
Unit Objectives
WALT (We Are Learning To)

By the end of the Unit you should have produced a Pacman game using Scratch
tools.
WILF (What I’m Looking For)








Use simple programming software
Learn how to sequence instructions for specific outcomes
Predict what might happen in a game from a sequence of instructions
Test a sequence of instructions
Modify a sequence of instructions, using repeated instructions where appropriate
Evaluate your own and other peoples games
Learn and use simple programming terms
Problem solve
You need to start with either
your own, if you finished
‘Workbook’ or my copy called
‘Finished Version’. If in doubt
start with mine. 
2
Cover Lesson for Scratch
List of contents
Teleport
Start and End Screens
Ghost and sprites etc.
Levels
Mr Dougall
3
Cover Lesson for Scratch
Mr Dougall
Teleport
First step is it change your background
E.g. from this
to this
To do this click here and here and draw two rectangles to the end of the screen
Script to make Pacman jump
Click on the Pacman sprite and go to the script area and add these two scripts. You need to match
the eye dropper tool for the colours to match – see arrows
4
Cover Lesson for Scratch
Mr Dougall
Start and End Screens
Do to this we need to make two new backgrounds for the stage. Rather than have to hide all the
other sprites we will use the middle space.
Start
Click on the Stage (1) then Background (black 2) copy (white 2) and edit (4)
2
2
4
1
5
Cover Lesson for Scratch
Mr Dougall
Click on the text Tool and add ‘Start’ to the centre.
Now copy another background so you have three and change the text to ‘The End’ in the centre.
6
Cover Lesson for Scratch
Mr Dougall
Script
Add the following to the Stage script
Spooky darlings: Ghosts
In this section we are going to add ‘enemies’ who will chase Pacman and cause you to lose a life.
Three lives and the game ends. The ghost can also be eaten when you have had a special ‘orb’.
Follow the instructions and Good luck!
Task 1: Make the ghost
a) Click New Sprite button
b) Draw a ‘ghost’
7
Cover Lesson for Scratch
c) Make a blue version
Click on ‘Costumes’ then ‘Copy’ and finally ‘Edit’
Use the Fill icon (paint can) to make the ghost blue
Rename the costumes
d) Script for ghost movement
Mr Dougall
8
Cover Lesson for Scratch
Now we need ‘lives’ for Pacman
e) Variable
Click on the stage
Click Variables then ‘Make a variable’.
Mr Dougall
9
Cover Lesson for Scratch
Name it ‘Lives’
Grab the following script to make Pacman have 3 lives
Now move the Lives counter to where it looks good on your stage.
Mr Dougall
10
Cover Lesson for Scratch
Mr Dougall
Script to kill Pacman!
Click back on the ghost sprite you made and grab the following tiles
This takes off a live each time he
gets caught
This stops the game when he runs
out of lives.
To broadcast you need to click on the drop down box and select ‘new’ and type ‘End game’
We will come back to ‘End game’ later.
Advanced Sprites
In the original game, Pacman collected dots, used ‘orbs’ to change his powers and then had random
fruit prizes.
We need to delete the extra sprites – right click delete until we have three fruits. One we will change
to a ‘dot’, one will become the ‘prize’ and finally the all avenging ‘orb’.
What you should end up with!
Dot
Click costumes then edit and make the fruit into a simple yellow dot.
Leave the script as this is perfect, but we need lots – keep duplicating until the whole path is
covered. Aim for about 50 evenly spaced.
11
Cover Lesson for Scratch
I made 45
Prize
Time to get random…
Click on another fruit. This time we want the costume not the script.
Click on scripts and make the following
Mr Dougall
12
Cover Lesson for Scratch
Mr Dougall
This should make the ‘prize’ appear randomly.
The real prize… when Pacman catches it lets make it worth 50 points
Use below script on the prize’s script area
REVENGE TIME: now let’s eat the ghosts!
Click on the last fruit, costumes, edit and make it into a simple white ‘orb’
We will need to make a broadcast which changes the ghost’s appearance and their behaviour
Click on ‘Orb’ script – delete the old one. Add this:
13
Cover Lesson for Scratch
Mr Dougall
Now we need to make ghosts run
Click on the ghost script and add the following script and then amend one of the others by adding
‘front’ and ‘normal’
Add these two
purple ones
Duplicate the Orb and put them at opposite ends of the screen.
14
Cover Lesson for Scratch
Mr Dougall
Levels
You are going to add one extra level, however if you have time you can add as many as you like!
It will work by using a hidden variable counter which will add the number of dots eaten when it
reaches the magic number i.e. the total number of dots it will reset the dots, return Pacman and
Ghost to their starting places add a second ghost to the new harder level.
‘The hidden counter’
Go to the stage >scripts>Variables>Make a new variable. Call it ‘Hidden’. Untick next to the new
variable so it does not appear on the stage. This would confuse the player.
Add the following script with a new broadcast called Next Level
Now here comes the fun part…
You need to add to each ‘dot’ this tile. You can drag and drop this on to each one then link them up
or add a whole new script.
Level 2 ghost
Duplicate the first one and change script to
15
Cover Lesson for Scratch
You may want to have it start in a slightly different position or change the speed etc.
Well done for reaching here. Hope it works… mine didn’t! ;P
Mr Dougall