creating a scratch packman

18
Creating a Scratch Packman

Upload: dylan

Post on 24-Feb-2016

70 views

Category:

Documents


0 download

DESCRIPTION

Creating a Scratch Packman. What you will learn:. To design a maze background To resize a sprite To move a sprite under keyboard control Stop the sprite moving over the background To get ‘prizes’ to disappear To score with the prizes To get the prize to appear again unexpectedly - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Creating  a  Scratch  Packman

Creating a Scratch Packman

Page 2: Creating  a  Scratch  Packman

What you will learn:• To design a maze background• To resize a sprite• To move a sprite under keyboard control• Stop the sprite moving over the background• To get ‘prizes’ to disappear• To score with the prizes• To get the prize to appear again unexpectedly• To choose your own prizes• To randomly alter the grid.

Page 3: Creating  a  Scratch  Packman

Stage 1 of Packman

Maze

Explorer‘Prize’

Score

Page 4: Creating  a  Scratch  Packman

Stage 2 of Packman

Explorer moves

Page 5: Creating  a  Scratch  Packman

Stage 3 of Packman

Explorer grabs prize

Score goes up

Page 6: Creating  a  Scratch  Packman

Stage 4 of Packman

Explorer moves on

Page 7: Creating  a  Scratch  Packman

Stage 5 of Packman

‘Prize’ reappears

Page 8: Creating  a  Scratch  Packman

What you need to decide• To decide on a maze background grid.• To decide on the sprite as the explorer.• To plan the ‘prizes’ – the sprites and the points for

each.• To plan for how long a prize would disappear.• To decide if the background will change to a new

level or will the grid alter randomly.

Page 9: Creating  a  Scratch  Packman

Design a background• The background must

have one colour that the sprite cannot cross (blue in the example.)

• The passage ways must be broad enough to take the sprite.

Page 10: Creating  a  Scratch  Packman

Replace the Cat1. Delete the cat sprite.2. Choose a new sprite

– use the central button under the stage. I called it the explorer.

3. Resize the sprite to make it small enough to follow the passages.

Step 2 Step 3Step 1

Page 11: Creating  a  Scratch  Packman

Get the Sprite to Move• Use the starting code

as below – make sure all directions work.

Page 12: Creating  a  Scratch  Packman

Keep the Sprite on Track

• Stop the sprite moving over the background by …

• … checking if it has moved too far.• If so, move back 5

Page 13: Creating  a  Scratch  Packman

Add a “Prize”

• Add a “prize” – a banana.• Place it in a passageway.• There should be a forever loop• The script should hide the

banana if it is touching the explorer.

• Remember to save your Scratch program.

Page 14: Creating  a  Scratch  Packman

Score Grabbing a Prize

• There are 2 parts• A variable to store the score

• The score needs to increase when the prize is grabbed.

Page 15: Creating  a  Scratch  Packman

Restore the Prize

• The banana needs to reappear and at a random time makes a difference.

• Use the pick random 1 to 10from Numbers

• Put it inside a wait.• Decide on the longest

and shortest waits• Remember to save your Scratch program.

Page 16: Creating  a  Scratch  Packman

Introduce another Prize

• Introduce other sprites as prizes.• Resize and add the correct script to each.

• Choose where each is to go, what effect it will have on the score, how quickly each should reappear.

• Remember to save your Scratch program.

Page 17: Creating  a  Scratch  Packman

Make your code efficient

• The script to stop the sprite going onto the grid might be more efficient.

• Do you have this section only once?

• Are there any other parts to be improved?

Page 18: Creating  a  Scratch  Packman

Further ideas• Does the score set to zero for each game?• Is there a time limit or a target score?• Further sprites could be added to block/unblock

sections of the grid.• This could make the game change as it is

played.• There could be different levels with the

background changing after a time.• There could be tunnels which move the player to

a new maze background …