Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB ›...

25
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 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 We’re going to make a recycling game! Catch the falling items, and put them in the correct recycling bins. Use the arrow keys to run left and right Press space bar to throw what you’re carrying Get the rubbish in the correct recycling bin Follow these INSTRUCTIONS one by one Recycling Scratch +

Transcript of Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB ›...

Page 1: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

1TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

ActivityChecklist

AllCodeClubsmustberegistered.Registeredclubsappearonthemapatcodeclub.org.uk-ifyourclubisnotonthemapthenvisitjumpto.cc/18CpLPytofindoutwhattodo.

IntroductionWe’regoingtomakearecyclinggame!Catchthefallingitems,andput

theminthecorrectrecyclingbins.

Usethearrowkeystorunleftandright

Pressspacebartothrowwhatyou’recarrying

Gettherubbishinthecorrectrecyclingbin

FollowtheseINSTRUCTIONSonebyone

RecyclingScratch

+

Page 2: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

2TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestyourProject

SaveyourProject

ClickonthegreenflagtoTESTyourcode

MakesuretoSAVEyourworknow

Page 3: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

3TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Step1:Createthecharacterthatwillpickuptherubbish

ActivityChecklist

1. StartanewScratchproject.

2. ChangethenameofSprite1tocatbyclickingontheblue i

symbol

3. Makesurethatitwillonlyflipleft-rightwiththeside-to-side

arrow.

4. Createavariable,forthisspriteonly,calledrunningspeed

5. Createavariable,forthisspriteonly,calledmaxspeed

6. Createavariable,forthisspriteonly,calledcats-direction

7. Untickallthreevariablessothey’renotshownontheStage

Page 4: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

4TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

8. UsetheMakeaBlockbuttoninMoreBlockstocreateanew

customblock

9. Namethenewcustomblockreset

10. Addascripttotheresetblockthatwillputthecatintheright

startingplaceandsetthespeedvariables

11. Createanothercustomblock,calledrun

12. Addthefollowingscripttorun,tomakeitpossibleforthecat

torunattherunningspeed,andslowdowngradually

Page 5: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

5TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

13. Combinethesewhenthegreenflagisclicked

14. Createacustomblockcalled“changedirectionifneeded”.It

shouldtakeonenumberinputcalleddirection

Page 6: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

6TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

15. Createacustomblockcalledspeedupifpossiblewhichwill

increasespeed,butonlyuntilthecatreachesmaxspeed

16. Starttobringthesetogetherwithanewcustomblockcalled

handlebuttonpresswhichtakesonenumberinputcalled

button-direction

Page 7: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

7TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

17. Finally,addascriptblockthatwillusethesecustomblocksto

controlthecat’srunning

18. Duplicateeachofthecat’stwocostumes.Wewanttwoofthe

firstcostume,andtwoofthesecondcostume.Thiswillprevent

therunninganimationfromflickeringtoomuch

Page 8: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

8TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Clickthegreenflag.

Saveyourproject

Usetheleftandrightarrowstorunfromsidetoside

Ifyouletgoofthearrowkeyafterpickingupspeed,thecatshould

slowdowngraduallyinsteadofstoppinginstantly

Ifyouswitchdirectionswhilerunning,thecatshouldskidinthewrong

directionbrieflybeforeswitching

Page 9: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

9TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Thingstotry

Tryadjustingthespeeds-thenumberinspeedupif

possiblecontrolshowfastthecataccelerates,the

maxspeedvalueinresetcontrolsthecat’stopspeed.

Page 10: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

10TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Step2:Addfallingrubbish

It’stimetomakeitemsforthecattorecycle!

ActivityChecklist

Preparethesprite

1. Uploadanewsprite,choosingResources/can.png

2. SwitchtotheCostumestab,anduploadanothercostume

usingResources/jar.png

3. UploadanothercostumeusingResources/newspaper.png

4. Thespriteshouldnowhavethreecostumes:acan,ajaranda

newspaper

Page 11: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

11TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Gettherubbishtofallfromthesky

5. Clickontheblue i nexttothesprite,andrenamethesprite

tobecalledobject

6. ResizethespritebyclickingontheShrinkbuttonatthetop

7. ClickontheSpriteinthemainstagewindowseveraltimes,until

itissmallerthanthecat

1. Createavariablethatwillcontrolthespeedtherubbishfalls,

calledspeed

Page 12: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

12TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

2. Untickthevariablesothevalueisn’tshownonthemainstage

3. Createacustomblockcalledresetthatwillsetthespeedto0

atthestart

4. Createacustomblockcalledfallingthatwillmaketheobject

fallatthisspeed

Page 13: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

13TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

5. Createacustomblockcalledgravitythatwillmakeitspeedup

asitfalls,butstopwhenithitstheground

6. Createacustomblockcalledchooseobjecttypethatwill

chooseatypeofrubbish

Page 14: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

14TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

7. Createacustomblockcalledstartatthetopthatmakes

eachnewbitofrubbishstartatadifferentplace

8. Createacustomblockcallednewobjecteveryfourseconds

9. Bringitalltogetherbycreatingthefollowingscript

Page 15: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

15TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Clickthegreenflag.Thecatshouldstillbeabletorunaround,butnow

rubbishshouldrainfromthesky,spinningasitfalls.

Thingstotry

Step3:Carryingtherubbish

Nowwewanttomakethecattobeabletopickupfallenrubbishandcarryit.

ActivityChecklist

Selecttherubbishobjectsprite.

Createvariablesthatwillletusdescribethedifferentcostumesof

object

Saveyourproject

Trychangingnewobjecteveryfoursecondstomake

rubbishfallmoreorlessoften

Trychanginggravitytochangethespeedthatobjectsfall

1. Createanewvariable,forthisspriteonly,calledcan

2. Createanewvariable,forthisspriteonly,calledjar

3. Createanewvariable,forthisspriteonly,callednewspaper

4. Untickthemallsothey’renotshownonthestage

5. Modifytheexistingresetcustomblocksothatitlookslike

this.Thenumbersshouldmatchthecostumenumbersforthe

sprite.

Page 16: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

16TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Createvariablestocontrolwhatthecatiscarrying

Controlhowobjectscanbecarried

1. Createanewvariable,forthisspriteonly,callednothing

2. Createanewvariable,forallsprites,calledcarrying

3. Untickthembothsothey’renotshownonthestage

4. Modifytheexistingresetcustomblock,toincludesettingboth

nothingandcarryingto4.Itshouldenduplookinglikethis.

1. Createanewcustomblockcalledwaittobecarriedthatlets

thecatpickupanobjectifit’snotalreadycarryingsomething.

Thiswillincludecreatinganeweventtobroadcastcarry-

Page 17: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

17TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Tryoutyourgameagain.

Thecatcancarryanitemofrubbish,andwilldropitwhenyoupressthe

spacebar.

change

2. Createanewscriptsoeachnewpieceofrubbishcanbe

carried

Saveyourproject

Page 18: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

18TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Step4:Throwingtherubbish

Thenextstepisforthecattobeabletothrowtherubbishit’scarryinginto

theairinsteadofdroppingit.

ActivityChecklist

1. Createacustomblockcalledthrowintheair

2. Modifytheexistingwaittobecarriedblocksothatthecat

throwstheobjectinsteadofdroppingitwhenyoupressspace.

Itshouldenduplikethis.

Page 19: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

19TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Tryoutyourgameagain.

Thecatcancarryanitemofrubbish,andwillthrowitintheairwhenyou

pressthespacebar.Itwillfallbacktothegroundandcanbepickedup

again.

Step5:Creatingrecyclingbins

ActivityChecklist

Startbysettingupabackgroundforthebins.

Addbinstothebackground

Saveyourproject

1. ClickonStage

2. ClickontheBackdropstab

3. ClickonChoosebackdropfromlibraryandchoosea

backgroundlikeboardwalk

4. Deletetheoriginalblankbackdrop‘backdrop1’

1. ClickonConverttovector

2. ClickonImportontheBackdropstab

Page 20: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

20TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Addlabelstothebins

3. ChooseResources/bin.png

4. ClickonSelect

5. Selectthebinandmoveandresizeittoputitonthe

boardwalkpath

6. Addtwomorebinssoitendsuplookingsomethinglikethis:

Page 21: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

21TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Addthebinopenings

1. ClickonText

2. Addlabelstothebins-oneformetal,oneforglass,onefor

paper

1. ClickonPaintnewsprite

2. ClickontheCostumestab

3. ClickonConverttovector

4. Drawafilledovalthatmatchestheopeningforoneofthebins

5. Clickontheblue i andrenametheSpritetobin-can

6. Addascriptthatdrawsthebinbehindthrownrubbish

Page 22: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

22TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

Gettherubbishtogointhebins

7. Duplicatethesprite

8. Calltheduplicatebin-jar

9. Moveittocoverthesecondbinopening

10. Duplicatethespriteagain

11. Calltheduplicatebin-newspaper

12. Moveittocoverthethirdbinopening

1. Clickontheobjectsprite

2. Createanewcustomblockcalledrubbishbinned

3. Createanewcustomblockcalledgointhebin

Page 23: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

23TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

4. Modifytheexistingwaittobecarriedcustomblocksothat

thrownobjectscangointhebininsteadoffallingbackdown.

Itshouldenduplookinglikethis.

Page 24: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

24TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Tryoutyourgameagain.

Thecatcannowthrowitemsintobins.Itemswillonlygointothecorrect

bins,otherwisethey’llfallbackdownontotheground.

Step6:Keepscore

Saveyourproject

Createanewvariable,forallsprites,calledscore

Movethescorevariableinthestageupintothecorner

Modifythecustomresetblockinthescriptsfortherubbishobjectsto

resetthescoreto0,soitshouldlooklike:

Modifythecustomrubbishbinnedblocksothatitaddstothescore.It

shouldlooklike:

Page 25: Scratch Recycling - Dale Lanedalelane.co.uk › drpbx › codeclubprojects › en-GB › 07_scratch... · 2016-10-01 · codeclub.org.uk - if your club is not on the map then visit

25TheseprojectsareforuseinCodeClubswithintheUK.Forc lubsoutsidetheUK,pleasevisitprojects.codeclubworld.org.Ourcurriculumisdeveloped

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

TestYourProject

Tryoutyourgameagain.

Thecatgetsapointforeveryitemthatisputintothecorrectrecycling

bin.

Saveyourproject

Welldone,you’vefinished!Nowyoucanenjoyyourgame!

Don’tforgetyoucanshareyourgamewithallyourfriendsandfamilyby

clickingonShareonthemenubar!