makingagame in scratch
DESCRIPTION
Showing how to make a game in scratch. All instructions all the user to create a game of pacmanTRANSCRIPT
Learning Outcomes
• To create a game using scratch software.
• To use scripts.
• To understand basic concept in programming.
Keywords
• Iteration – forever loop
• Selection – forever if
• Variables
Following instructions
• Backward 2
• Forward 2
• Turn 180
• Hands up
• Hands down
Following instructions
Forever
Backward 2
Forward 2
Turn 180
Hands up
Hands down
Following instructions
Forever if (my hand up)
Backward 2
Forward 2
Turn 180
Hands up
Hands down
Where to open the task
• P:\ICT folder\Year 7 ICT\Topic 6 Game on\Lesson 4
• Makingagame.ppt
Plenary
•P:\ICT folder\Year 7 ICT\Topic 6 Game on\Lesson 4
•Complete the plenary.doc
Step 1
1.Delete the cat sprite. Right click on the sprite and select delete.
Step 2 - Changing backgrounds
1. Click on the stage
2.Select backgroundClick on Edit
Step 3 -Adding background colour
Use the fill tool to create the background
Step 4 - Adding a grid
Use the rectangle tool to create the grid
Step 5 - Create a pacman sprite1. Select the paint new sprite button
2. Create your pacman2
1
Step 6 – adding the dot
Use the paint brush to draw a dot in front of pacman. This should be different colour to the Pacman
Save your pacman by clicking OK
3
Step 7 - Create a new costume
2.Click on copy to create a new costumeClick on Edit for Costume2
3. Use the erase tool to create a mouthClick OK
1
2
1. Select the costume tab
Step 9 – creating a new sprite
Click on create new sprite
1
Step 10 - Create a target sprite
Draw a circle the same colour as your background.
Draw another circle in the same coloured dot. (i.e orange)
Step 11 - Shrink your spritesClick on the icon to shrink your sprite
Step 12 - Duplicating your sprites
Step 13 - Script blocks
Create a script for the sprite to change costume.
Hint Use the colour coding to help you
Step 14 - Scripts to control movement of your pacman
Create a new script.This will move the pacman
This is the colour of the dot
This is the colour of your background
Step 15 - Script to control direction
Create scripts to move the sprite right, left, up and down.
Step 16 - Make a variable
Click on the stage
Click on variables
Give variable name orangecount
Step 17 - Set the starting value
Add this script to the stage
Step 18 - Change the variable
1.Click on Sprite2
Add the code to sprite 2
Step 19 - Duplicate script and add to other sprites
Right click and click duplicate
Drag the duplicate to the other sprites
Step 20 - Stopping the game
Click on the stage
Create this script
Change this to match the number of oranges
Step 21 - Game TimerCreate a new variable called timer
Create this script to set the timer to go up by one second each time
Challenges
• Can you write short scripts to do the following:-• 1. Reset the time to zero at the start of the
game?• 2. Replace the Pacman in the top left hand
corner at the start of the game?• 3. reposition Pacman to face twoards the
righthand side of the screen. • (hint if you click on the sprite you can see the
coordinates and position.
Include a bonus feature
Choose new sprite from file
Select from the folder
Place the bonus symbol on the board
• Create a new variable called speed• In the stage scripts area, set the
starting value to 2• Adjust the pacman sprite script to• Click on bonus spite. Duplicate the
script from other sprites.• Change the script to double the speed.
(hint set the speed variable to 4)
Changing the bonus sprite
Add this script to the bonus sprite.
Remember to change the orange count to 5
Create a ‘Game Over’ screen
Create a new background by clicking on copy
Click on Edit on background 2
Add the text Game Over
Game over script
Add the final script to the stage to finish the game
plenary
• Write down what you have done today on your game.
• Write down what scripts you have used an try to explain how one of them works.