Harry Potter Game

33
Adventures in Animation Harry Potter Game Harry Potter Game Pranali Choubal Pranali Choubal Kunal Shaw Kunal Shaw Barb Ericson Barb Ericson Dec 2007 Dec 2007

description

Harry Potter Game. Pranali Choubal Kunal Shaw Barb Ericson Dec 2007. The Game. Use the arrow keys to move Harry Potter to catch the golden snitch to avoid the bludger. Getting Started. Start Scratch Delete the cat Click on scissors and then the cat - PowerPoint PPT Presentation

Transcript of Harry Potter Game

Page 1: Harry Potter Game

Adventures in Animation

Harry Potter GameHarry Potter GameHarry Potter GameHarry Potter GamePranali ChoubalPranali Choubal

Kunal ShawKunal ShawBarb EricsonBarb Ericson

Dec 2007Dec 2007

Page 2: Harry Potter Game

Adventures in Animation

The Game• Use the arrow

keys to move Harry Potter – to catch the

golden snitch– to avoid the

bludger

Page 3: Harry Potter Game

Adventures in Animation

Getting Started• Start Scratch• Delete the cat

– Click on scissors and then the cat

– or right click on the cat and pick delete

Page 4: Harry Potter Game

Adventures in Animation

Change the Background

• Click on the stage to select it

• Click on the Backgrounds tab

• Click on the import button

Page 5: Harry Potter Game

Adventures in Animation

Select New Background• Navigate to

HarryPotter folder Select the Stadium and click OK

Page 6: Harry Potter Game

Adventures in Animation

The Stage is Set

Page 7: Harry Potter Game

Adventures in Animation

Add Harry Potter• Click on the folder

with a star on it to add a sprite from a file

• Navigate to the HarryPotter folder

• Add Harry.sprite

Page 8: Harry Potter Game

Adventures in Animation

The Game so Far

Page 9: Harry Potter Game

Adventures in Animation

Making Harry Move• Click on the Scripts Tab• Click on Control and drag

out – When space key pressed– Change to left arrow key

• Click on Looks and drag out– switch to costume – Change to Harry_Left

• Click on Motion and drag out– change x by 1– click on 1 and change to -

4

Page 10: Harry Potter Game

Adventures in Animation

Add Other Key Scripts• Right arrow

– change to Harry_Right costume

– change x by 4

• Down arrow– change y by -4

• Up arrow– change y by 4

Page 11: Harry Potter Game

Adventures in Animation

Add the Golden Snitch• Click on the folder

with a star on it to add a sprite from a file

• Navigate to the HarryPotter folder

• Add snitch.sprite

Page 12: Harry Potter Game

Adventures in Animation

Harry and the Snitch

Page 13: Harry Potter Game

Adventures in Animation

Snitch Behavior• In a 'normal' Quidditch game the game

is over when the snitch is caught• But, in this game you will have to catch

10 snitches to win.– you will need to keep track of the number

caught

• Each time the snitch is caught it will hide and reappear in a new random location

Page 14: Harry Potter Game

Adventures in Animation

Variables• To remember how many

snitches were caught we will need a variable– the value stored in a

variable can change (vary)

• Click on the Variables button

• Then click on Make a Variable

• Enter a name for the variable

Page 15: Harry Potter Game

Adventures in Animation

Starting• Scratch games and

animations usually start when you click the green flag

• Click on Stage• Click on Scripts• Click on Control• Drag the "when green

flag clicked" tile out• Click on Variables

– drag the "set Snitches Caught to 0"

Page 16: Harry Potter Game

Adventures in Animation

Messages• Scripts can wait for

messages and broadcast messages– tiles are in the Control area

• Click on the snitch sprite, then Scripts then Control

• To create a message drag out the "when I receive" and click on the down arrow– then on new…

• Give the message a name– click on OK

Page 17: Harry Potter Game

Adventures in Animation

Responding to Caught• Hide the snitch

– drag hide from Looks• Add one to the number of

snitches caught– drag from Variables

• Change the x and y values– drag from motion– replace values with random

numbers • from Number

• Show the snitch– drag from Looks

• Play a sound– drag from Sound

Page 18: Harry Potter Game

Adventures in Animation

Catching the Snitch• If the Harry Potter sprite is

touching the snitch sprite – add if

• Control– add "touching …" and

change to "Sprite3"• from Sensing

• Broadcast the Caught message

• from Control• Right click on if part and

pick "duplicate" – and add to all the other

scripts for Harry Potter

Page 19: Harry Potter Game

Adventures in Animation

Winning the Game• In the snitch script that

receives the caught message– drag in a if and else

• from Control– move the last 3 tiles into

the else part– drag in a "blank = blank"

• from Number– drag in "Snitches Caught"

• from Variables – click on second blank and

type in 10– drag in a broadcast tile

• Create new message "Won"

Page 20: Harry Potter Game

Adventures in Animation

Telling the User• Click on Stage• Click on

Backgrounds• Click on Import• Navigate to

HarryPotter folder• Select Congrats

– click on OK

Page 21: Harry Potter Game

Adventures in Animation

Stage Scripts• Click on Stage and Scripts• Set the initial background

to the stadium – when the green flag is

clicked• from Looks

• When receive Won message– from Control– switch background to

Congrats• from Looks

Page 22: Harry Potter Game

Adventures in Animation

Hide Other Sprites• If the user has won

– hide the other sprites• Harry Potter• Snitch

– You can click on the "when I receive Won"

• and drag it to the other sprite to copy it

Page 23: Harry Potter Game

Adventures in Animation

When Game Starts• If the user wins and

Harry and the Snitch hide when you restart the game– they won't show

again

• Add "when green flag clicked" show to:– Harry – Golden Snitch

Page 24: Harry Potter Game

Adventures in Animation

Making it Harder• add a Bludger• if the Bludger hits

Harry he "dies"– start with 3 lives– lose a life each time

Harry dies

• if Harry loses all 3 lives you lose the game

Page 25: Harry Potter Game

Adventures in Animation

Add Lives Variable• Click on Variables• Click on Make a

variable• Enter Lives• Drag display to

top right

Page 26: Harry Potter Game

Adventures in Animation

Start with 3 Lives• Click on Stage• Click on Scripts• Add "set Lives to

0" • Click on 0 and

change to 3

Page 27: Harry Potter Game

Adventures in Animation

Painting a Bludger• You can paint a new

sprite– click on the paintbrush

with a star on it

• Click the color• Click the circle shape

tool• Click and drag to

make the circle• Click on OK

Page 28: Harry Potter Game

Adventures in Animation

Bludger Scripts• When the green flag is

clicked loop forever– set x– hide – wait for some random

amount of time– show – Glide to opposite side

• random y• Also loop forever

– check if touching Harry• play sound• change number of lives• check if lost• wait till not touching Harry

Page 29: Harry Potter Game

Adventures in Animation

Tell User Game Over• Click on Stage• Click on

Backgrounds• Click on Import• Select

HarryPotter folder• Select Game Over• Click OK

Page 30: Harry Potter Game

Adventures in Animation

New Stage Script• Click on Scripts• Add "when I receive

Lost"– from Control

• Add "switch background Game Over"– from Looks

• Add "stop all"– from Control

Page 31: Harry Potter Game

Adventures in Animation

Hide Sprites When Lose• When the game is

lost– hide Harry– hide the Snitch

Page 32: Harry Potter Game

Adventures in Animation

Project Notes• Click on the notepad

in the top right corner

• Type in project notes• You can upload your

project to the Scratch web site– Click on Share!– See it at

http://scratch.mit.edu

Page 33: Harry Potter Game

Adventures in Animation

Extensions• Speed up the Bludger each time

after 5 snitches have been caught– Will need a variable "Time to Cross"

• Add background music– Import Theme.wav