+ All Categories
Home > Documents > Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then...

Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then...

Date post: 23-Jun-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
14
1 These projects are for use in Code Clubs within the UK. For clubs outside the UK, please visit projects.codeclubworld.org. Our curriculum is developed in the open on GitHub (github.com/CodeClub), and we encourage contributions from our community - 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 codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Follow these INSTRUCTIONS one by one Click on the green flag to TEST your code Make sure to SAVE your work now Memory Scratch 2
Transcript
Page 1: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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

Page 2: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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.

Page 3: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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’.

Page 4: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

4TheseprojectsareforuseinCodeClubswithintheUK.ForclubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdevelopedintheopenon

GitHub(github.com/CodeClub),andweencouragecontributionsfromourcommunity-comeandjoinus!

Youshouldnowseeyouremptylistinthetop-leftofyour

stage,aswellaslotsofnewblocksforusinglists.

5. Addthiscodetoyourcharacter,toaddarandomnumberto

yourlist(andshowthecorrectcostume)5times:

Page 5: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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.

Page 6: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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!

Page 7: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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.

Page 8: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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

Page 9: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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:

Page 10: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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:

Page 11: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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’.

Page 12: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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

Page 13: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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

Page 14: Scratch 2 Memory - Computing Unlocked · codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18CpLPy to find out what to do. Introduction In this project, you will

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


Recommended