Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 42 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
42
Dung lượng
1,95 MB
Nội dung
HarryPotterScratchGame Pranali Choubal Kunal Shah Barb Ericson ericson@cc.gatech.edu Dec 2007 HarryPotterScratchGame The Game • Use the arrow keys to move HarryPotter – to catch the golden snitch – to avoid being hit by the bludger HarryPotterScratch Gam e Getting Started • Start Scratch • Delete the cat – Click on scissors and then the cat – or right click on the cat and pick delete HarryPotterScratch Gam e Change the Background • Click on the stage to select it • Click on the Backgrounds tab • Click on the import button HarryPotterScratch Gam e Select New Background • Navigate to the HarryPotter folder Select the Stadium and click OK HarryPotterScratch Gam e The Stage is Set HarryPotterScratch Gam e Add HarryPotter • Click on the folder with a star on it to add a sprite from a file • Navigate to the HarryPotter folder • Add HarryHarryPotterScratch Gam e The Game so Far HarryPotterScratch Gam e Scratch is Event Driven • You can make things happen when events occur – such as a key is pressed – the green flag is clicked on – a message is received HarryPotterScratch Gam e 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 – click on and change to -4 HarryPotterScratch Gam e 10 Stage Scripts • Click on Stage and Scripts • Set the initial background to the stadium – when the green flag is clicked • from Looks • When the stage receives a Won message – from Control – switch background to Congrats • from Looks HarryPotterScratch Gam e 28 Hide Other Sprites • If the user has won – hide the other sprites • HarryPotter • Snitch – You can click on the "when I receive Won" • and drag it to the snitch sprite to copy it • then click on the snitch sprite and scripts to check the copy worked HarryPotterScratch Gam e 29 When Game Starts • If the user wins and Harry and the Snitch hide when you restart the game – they won't show again if you start a new game • Add "when green flag clicked" show to: – Harry – Golden Snitch HarryPotterScratch Gam e 30 Making it Harder • add a Bludger • if the Bludger hits Harry he "dies" – start with lives – lose a life each time Harry dies • if Harry loses all lives you lose the gameHarryPotterScratch Gam e 31 Add Lives Variable • Click on Variables • Click on Make a variable • Enter Lives • Drag display to top right HarryPotterScratch Gam e 32 Start with Lives • Click on Stage • Click on Scripts • Add "set Lives to 0" • Click on and change to HarryPotterScratch Gam e 33 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 HarryPotterScratch Gam e 34 Loops • Sometimes you want to repeat blocks until the game ends or something happens • Use a forever block to repeat actions until the game ends – use a stop all block to stop all scripts • Use a repeat block to repeat some actions a given number of times HarryPotterScratch Gam e 35 Bludger Scripts • When the green flag is clicked loop forever – set x to 260 – hide the bludger – wait for some random amount of time between and seconds – show the bludger – Glide to the opposite side • x is -260 • random y from -145 to 145 HarryPotterScratch Gam e 36 Bludger Scripts • When the green flag is clicked, loop forever – check if touching Harry • play a sound • reduce the number of lives • check if lost – lives = • wait till not touching Harry – or you will die quickly HarryPotterScratch Gam e 37 Tell User Game Over • Click on Stage • Click on Backgrounds • Click on Import • Select HarryPotter folder • Select Game Over • Click OK HarryPotterScratch Gam e 38 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 • Add "stop all" to the end of when receive "Won" script too HarryPotterScratch Gam e 39 Hide Sprites When Lose • When the game is lost – hide Harry – hide the Snitch HarryPotterScratch Gam e 40 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 HarryPotterScratch Gam e 41 Extensions • Speed up the Bludger each time a snitch has been caught – Will need a variable for "Time to Cross" – Reduce the variable each time each time the snitch is caught • Add background music – Import Theme.wav – Add a script to the stage • When the green flag is clicked • Loop forever playing the theme and waiting for it to finish • Make the Bludger come from any direction – and glide across to the opposite side • Add Beaters who can hit the Bludger away – Using the space key • Add a time limit – That counts done HarryPotterScratch Gam e 42 ... to add a sprite from a file • Navigate to the HarryPotter folder • Add Harry Harry Potter Scratch Gam e The Game so Far Harry Potter Scratch Gam e Scratch is Event Driven • You can make things... Background • Navigate to the HarryPotter folder Select the Stadium and click OK Harry Potter Scratch Gam e The Stage is Set Harry Potter Scratch Gam e Add Harry Potter • Click on the folder with... "Won" Harry Potter Scratch Gam e 26 Telling the User • Click on Stage • Click on Backgrounds • Click on Import • Navigate to HarryPotter folder • Select Congrats – click on OK Harry Potter Scratch