Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop...

15
1 These projects are for use outside the UK only. More information is available on our website at www.codeclubworld.org. This coursework is developed in the open on GitHub, at www.github.com/CodeClub. Come and join us! Activity Checklist Test your Project Save your Project All Code Clubs must be registered . Registered clubs appear on the map at codeclubworld.org - if your club is not on the map then visit jumpto.cc/ccwreg to register your club. Introduction In this project you’ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds. Follow these INSTRUCTIONS one by one Click on the green flag to TEST your code Make sure to SAVE your work now Brain Game Scratch 2

Transcript of Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop...

Page 1: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

1TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

ActivityChecklist

TestyourProject

SaveyourProject

AllCodeClubsmustberegistered.Registeredclubsappearonthemapatcodeclubworld.org-ifyourclubisnotonthemapthenvisitjumpto.cc/ccwregtoregisteryourclub.

IntroductionInthisprojectyou’lllearnhowtocreateatimestablequiz,inwhichyou

havetogetasmanyanswerscorrectasyoucanin30seconds.

FollowtheseINSTRUCTIONSonebyone

ClickonthegreenflagtoTESTyourcode

MakesuretoSAVEyourworknow

BrainGameScratch

2

Page 2: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

2TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Step1:Creatingquestions

Let’sstartbycreatingrandomquestionsfortheplayertoanswer.

ActivityChecklist

1. StartanewScratchproject,anddeletethecatspritesothat

yourprojectisempty.YoucanfindtheonlineScratcheditor

atjumpto.cc/scratch-new.

2. Chooseacharacterandabackdropforyourgame.Youcan

chooseanyyoulike!Here’sanexample:

3. Create2newvariablescalled number1 and number2 .These

variableswillstorethe2numbersthatwillbemultiplied

together.

Page 3: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

3TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

4. Addcodetoyourcharacter,tosetbothofthesevariablesto

a random numberbetween2and12.

5. Youcanthenasktheplayerfortheanswer,andletthemknow

iftheywererightorwrong.

6. Testyourprojectfully,byansweringonequestioncorrectly

andonewiththewronganswer.

7. Adda forever looparoundthiscode,sothattheplayeris

askedlotsofquestions.

8. Createacountdowntimeronthestage,usingavariablecalled

time .The‘Balloons’projecthasinstructionsformakinga

timer(instep6)ifyouneedhelp!

9. Testyourprojectagain-youshouldbeabletocontinueasking

questionsuntilthetimerunsout.

Page 4: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

4TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Changingcostumes

Canyouchangeyourcharacter’scostumes,sothatthey

respondtotheplayer’sanswer?

Challenge:Addingascore

Canyouaddascoretoyourgame?Youcanaddapointfor

everycorrectanswer.Ifyou’refeelingmean,youcouldeven

resettheplayer’sscoreto0iftheygetaquestionwrong!

Saveyourproject

Saveyourproject

Page 5: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

5TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Step2:Multiplegames

Let’sadda‘play’buttontoyourgame,sothatyoucanplaylotsoftimes.

ActivityChecklist

1. Createanew‘Play’buttonsprite,whichyourplayerwillclickto

startanewgame.Youcandrawityourself,oreditasprite

fromtheScratchlibrary.

2. Addthiscodetoyournewbutton.

Thiscodeshowstheplaybuttonwhenyourprojectisstarted.

Whenthebuttonisclicked,itishiddenandthenbroadcastsa

messagethatwillstartthegame.

3. You’llneedtoedityourcharacter’scode,sothatthegame

startswhentheyreceivethe start message,andnotwhen

theflagisclicked.

Page 6: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

6TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Replacethe whenflagclicked codewith whenIreceive

start .

4. Clickthegreenflagandthenclickyournewplaybuttontotest

it.Youshouldseethatthegamedoesn’tstartuntilthebutton

isclicked.

5. Didyounoticethatthetimerstartswhenthegreenflagis

clicked,andnotwhenthegamestarts?

Canyoufixthisproblem?

6. Clickonthestage,andreplacethe stopall blockwithan

end message.

Page 7: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

7TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

7. Youcannowaddcodetoyourbutton,toshowitagainatthe

endofeachgame.

8. You’llalsoneedtostopyourcharacteraskingquestionsatthe

endofeachgame:

9. Testyourplaybuttonbyplayingacoupleofgames.Youshould

noticethattheplaybuttonshowsaftereachgame.Tomake

testingeasier,youcanshorteneachgame,sothatitonlylasts

afewseconds.

10. Youcanevenchangehowthebuttonlookswhenthemouse

hoversoverit.

Page 8: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

8TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Startscreen

Canyouaddanotherbackdroptoyourstage,whichwillbecome

yourgame’sstartscreen?Youcanusethe whenIreceive

start and whenIreceiveend blockstoswitchbetween

backdrops.

Youcanalsoshowandhideyourcharacter,andevenshowand

hideyourtimerbyusingtheseblocks:

Saveyourproject

Saveyourproject

Page 9: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

9TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Step3:Addinggraphics

Insteadofyourcharacterjustsaying yes!:) or nope:( totheplayer,let’s

addsomegraphicsthatwilllettheplayerknowhowtheyaredoing.

Createanewspritecalled‘Result’,containingbotha‘tick’anda‘cross’

costume.

Changeyourcharacter’scode,sothatinsteadoftellingtheplayerhowthey

did,itbroadcasts correct and wrong messagesinstead.

Youcannowusethesemessagestoshowthe‘tick’or‘cross’costume.Add

thiscodetoyournew‘Result’sprite:

Page 10: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

10TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Testoutyourgameagain.Youshouldseeatickwheneveryougeta

questioncorrect,andacrosswheneveryougetonewrong!

Haveyounoticedthatthecodefor whenIreceivecorrect and whenI

receivewrong isnearlyidentical?Let’screateafunctiontomakeiteasier

foryoutomakechangestoyourcode.

Onyour‘Result’sprite,click MoreBlocks ,andthen‘MakeaBlock’.Create

anewfunctioncalled animate .

Page 11: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

11TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Youcanthenaddtheanimationcodeintoyournewanimationfunction,and

thenjustusethefunctiontwice:

Now,ifyouwanttoshowthetickandthecrossforalongerorshorter

time,youonlyneedtomakeonechangetoyourcode.Tryit!

Insteadofjustshowingandhidingthetickandthecross,youcouldchange

youranimationfunction,sothatthegraphicsfadein.

Page 12: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

12TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Improvedanimation

Canyouimprovetheanimationofyourgraphics?Youcould

codethetickandcrosssothattheyfadeoutaswellasfadein.

Or,youcoulduseothercooleffects:

Saveyourproject

Saveyourproject

Page 13: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

13TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Soundandmusic

Canyouaddsoundeffectsandmusictoyourgame?For

example:

Playingasoundwhentheplayergetsananswerrightor

wrong;

Addingatickingsoundtoyourcountdowntimer;

Playingasoundwhenthetimeisup;

Youcouldalsoconstantlyplaymusiconaloop(ifyou’re

notsurehowtodothis,step4ofthe‘RockBand’project

willhelpyou).

Saveyourproject

Page 14: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

14TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Raceto10points

Canyouchangeyourgame,sothatinsteadofansweringas

manyquestionsastheycanin30seconds,theplayerhasto

seehowquicklytheycanget10questionscorrect?

Todothis,you’llonlyneedtochangeyourtimercode.Canyou

seewhatneedstobechanged?

Saveyourproject

Page 15: Scratch 2 Brain Game - Mrs Armenio's Web class...end of each game. 8. You’ll also need to stop your character asking questions at the end of each game: 9. Test your play button by

15TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

ThiscourseworkisdevelopedintheopenonGitHub,atwww.github.com/CodeClub.Comeandjoinus!

Challenge:Instructionscreen

Canyouaddaninstructionsscreentoyourgame,tellingyour

playerhowtoplaythegame?You’llneedan‘Instructions’

button,andanotherstagebackground.

Youmayalsoneeda‘Back’buttontotakeyoutothemain

menu.

Saveyourproject