1TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
ActivityChecklist
TestyourProject
SaveyourProject
AllCodeClubsmustberegistered.Registeredclubsappearonthemapatcodeclub.org.uk-ifyourclubisnotonthemapthenvisitjumpto.cc/18CpLPytofindoutwhattodo.
IntroductionInthisproject,youwillcreateamemorygamewhereyouhaveto
memoriseandrepeatasequenceofrandomcolours!
FollowtheseINSTRUCTIONSonebyone
ClickonthegreenflagtoTESTyourcode
MakesuretoSAVEyourworknow
MemoryScratch
2
2TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Step1:Randomcolours
First,let’screateacharacterthatcanchangetoarandomsequenceof
coloursfortheplayertomemorise.
ActivityChecklist
1. StartanewScratchproject,anddeletethecatspritesothat
yourprojectisempty.YoucanfindtheonlineScratcheditor
atjumpto.cc/scratch-new.
2. Chooseacharacterandabackdrop.Yourcharacterdoesn’t
havetobeaperson,butitneedstobeabletoshowdifferent
colours.
3. Inyourgame,you’lluseadifferentnumbertorepresenteach
colour:
1=red;
2=blue;
3=green;
4=yellow.
3TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Giveyourcharacter4differentcolourcostumes,oneforeach
ofthe4coloursabove.Makesurethatyourcoloured
costumesareintherightorder.
4. Tocreatearandomsequence,youneedtocreatealist.Alist
isjustavariablethatstoreslotsofdatainorder.Createa
newlistcalled sequence .Asonlyyourcharacterneedstosee
thelist,wecanalsoclick‘Forthisspriteonly’.
4TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Youshouldnowseeyouremptylistinthetop-leftofyour
stage,aswellaslotsofnewblocksforusinglists.
5. Addthiscodetoyourcharacter,toaddarandomnumberto
yourlist(andshowthecorrectcostume)5times:
5TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Challenge:Addingsound
Testyourprojectafewtimes.Youmaynoticethatsometimes
thesamenumberischosentwice(ormore)inarow,making
thesequencehardertomemorise.Canyoumakeadrumsound
playeachtimethecharacterchangescostume?
Canyoumakeadifferentdrumsoundplaydependingonthe
randomnumberchosen?Thiswillbeverysimilartoyourcodeto
changethecharacter’scostume.
Step2:Repeatingthesequence
Let’sadd4buttons,fortheplayertorepeatthesequencethey’ve
remembered.
ActivityChecklist
Noticethatyouhavealsoemptiedthelisttobeginwith.
Saveyourproject
1. Add4spritestoyourproject,thatwillbecomebuttons.Edit
your4sprites,sothatthere’s1foreachofthe4colours.
6TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
2. Whenthereddrumisclicked,you’llneedtobroadcasta
messagetoyourcharacter,lettingthemknowthatthered
buttonhasbeenclicked.Addthiscodetoyourreddrum:
3. Whenyourcharacterreceivesthismessage,theyshouldcheck
whetherthenumber1isatthestartofthelist(whichmeans
thatredisthenextcolourinthesequence).Ifitis,youcan
removethenumberfromthelist,asit’sbeenguessed
correctly.Otherwiseit’sgameover!
7TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
4. Youcouldalsodisplaysomeflashinglightsoncethelistis
empty,asitmeanstheentiresequencehasbeenguessed
correctly.Addthiscodetotheendofyourcharacter’s when
flagclicked script:
5. Clickonyourstage,andaddthiscodetomakethebackdrop
changecolouroncetheplayerhaswon.
8TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Challenge:Creating4buttons
Repeatthestepsaboveforyourblue,greenandyellowbuttons.
Whichcodewillstaythesame,andwhichcodewillchangefor
eachbutton?
Youcanalsoaddsoundsforwhenthebuttonsarepressed.
Remembertotestthecodeyou’veadded!Canyoumemorisea
sequenceof5colours?Isthesequencedifferenteachtime?
Saveyourproject
9TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Step3:Multiplelevels
Sofar,theplayeronlyhastoremember5colours.Let’simproveyourgame,so
thatthelengthofthesequenceincreases.
ActivityChecklist
1. Createanewvariablecalled score .
2. This score willbeusedtodecideonthelengthofthe
sequencetheplayerhastomemorise.So,tobeginwiththe
score(andthesequencelength)is3.Addthiscodeblockto
thestartofyourcharacter’s whenflagclicked code:
3. Insteadofalwayscreatingasequenceof5colours,younow
wantthe score todeterminethesequencelength.Change
yourcharacter’s repeat loop(forcreatingthesequence)to:
4. Ifthesequenceisguessedcorrectly,youshouldadd1tothe
score,toincreasethelengthofthesequence.
5. Finally,youneedtoadda forever looparoundthecodeto
generatethesequence,sothatanewsequenceiscreatedfor
eachlevel.Thisishowyourcharacter’scodeshouldlook:
10TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Step4:Highscore
Let’ssavethehighscore,sothatyoucanplayagainstyourfriends.
ActivityChecklist
6. Getyourfriendstotestoutyourgame.Remembertohidethe
sequence listbeforetheyplayit!
Saveyourproject
1. Add2newvariablestoyourproject,called highscore and
name .
2. Ifeverthegameends(bypressingthewrongbutton),you
needtocheckwhethertheplayer’sscoreishigherthanthe
currenthighscore.Ifitis,youneedtosavethescoreasthe
highscore,andstorethenameoftheplayer.Here’showyour
redbuttonshouldlook:
11TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
3. You’llneedtoaddthisnewcodetotheother3buttonstoo!
Haveyounoticedthatthe‘Gameover’codeineachofthe4
buttonsisexactlythesame?
4. Ifeveryouneedtochangeanyofthiscode,suchasaddinga
soundorchangingthe‘Gameover!’message,you’dhaveto
changeit4times!Thatcouldgetannoying,andwastealotof
time.
Instead,youcandefineyourownblocks,andreusethemin
yourproject!Todothis,click moreblocks ,andthen‘Makea
block’.Callthisnewblock‘Gameover’.
12TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
5. Addthecodefromthe else blockfromtheredbuttontothe
newblockthatappears:
6. You’venowmadeanewfunctioncalled Gameover ,whichyou
canuseanywhereyoulike.Dragyournew Gameover block
ontothe4scriptsforthebuttons.
7. Nowaddasoundforwhenthewrongbuttonispressed.You
13TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Challenge:Makingmoreblocks
Doyounoticeanyothercodethatisthesameforall4
buttons?
Canyoumakeanothercustomblock,thatisusedbyeach
button?
onlyneedtoaddthiscodeonceinthe Gameover blockthat
youmade,andnot4separatetimes!
Saveyourproject
14TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon
GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!
Challenge:Anothercostume
Haveyounoticedthatyourgamestartswithyourcharacter
showingoneofthe4colours,andthattheyalwaysdisplaythe
lastcolourinthesequencewhiletheplayerisrepeatingthe
sequence?
Canyouaddanotherplainwhitecostumetoyourcharacter,
whichisdisplayedatthestartofyourgame,andwhenthe
playeristryingtocopythesequence?
Challenge:Difficultylevel
Canyouallowyourplayertochoosebetween‘easymode’(using
justtheredandbluedrums)and‘normalmode’(whichusesall
4drums)?
Youcouldevenadda‘hard’mode,whichmakesuseofa5th
drum!
Saveyourproject
Saveyourproject