Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
1©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
ActivityChecklist
TestyourProject
SaveyourProject
AllCodeClubsmustberegistered.Byregisteringyourclubwecanmeasureourimpact,andwecancontinuetoprovidefreeresourcesthathelpchildrenlearntocode.Youcanregisteryourclubatcodeclubworld.org.
IntroductionYouaregoingtolearnhowtoprogramyourownanimation!
FollowtheseINSTRUCTIONSonebyone
ClickonthegreenflagtoTESTyourcode
MakesuretoSAVEyourworknow
LostinSpaceScratch
1
2©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Step1:Animatingaspaceship
Let’smakeaspaceshipthatfliestowardstheEarth!
ActivityChecklist
StartanewScratchproject,anddeletethecatspritesothat
yourprojectisempty.YoucanfindtheonlineScratcheditor
atjumpto.cc/scratch-new.
Add‘Spaceship’and‘Earth’spritestoyourstage.Youshould
alsoaddthe‘Stars’backdroptoyourstage.Thisishowyour
stageshouldlook:
Clickonyournewspaceshipsprite,andclickthe‘Costumes’
tab.
3©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Usethearrowtooltoselecttheimage.Thenclickonthe
circularrotatehandle,androtatetheimageuntilitisonits
side.
Addthiscodetoyourspaceshipsprite:
Changethenumbersinthecodeblocks,sothatthecodeis
4©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
exactlythesameasintheimageabove.
Ifyouclickonthecodeblockstorunthecode,youshouldsee
thespaceshipspeak,turnandmovetowardsthecentreofthe
stage.
Thescreenposition x:(0)y:(0) isthecenterofthestage.A
positionlike x:(-150)y:(-150) istowardsthebottom-leftof
thestage,andapositionlike x:(150)y:(150) isnearthetop-
right.
5©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Ifyouneedtoknowthecoordinatesofapositiononthestage,
movethemousetothepositionyouwantandmakeanoteof
thecoordinates,whicharedisplayedbelowthestage.
Tryoutyouranimation,byclickingonthegreenflagjustabove
thestage.
6©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Challenge:Improvingyouranimation
Canyouchangethenumbersinyouranimationcode,sothat:
You’llneedtochangethenumbersinthisblock:
ThespaceshipmovesuntilittouchestheEarth?
ThespaceshipmovesmoreslowlytowardstheEarth?
Saveyourproject
7©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Step2:Animatingusingloops
Anotherwayofanimatingthespaceshipistotellittomoveasmallamount,
lotsoftimes.
ActivityChecklist
Deletethe glide blockfromyourcode,byright-clickingon
theblockandclicking‘delete’.Youcanalsodeletecodeby
draggingitoffthescriptarea,backintothecodeblocksarea.
Onceyou’veremovedyourcode,addthiscodeinstead:
The repeat blockisusedtorepeatsomethinglotsoftimes,
andisalsoknownasaloop.
Ifyouclicktheflagtotryoutthisnewcode,you’llseethatit
doesprettymuchthesamethingasbefore.
8©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Youcanaddmorecodetoyourloop,todointerestingthings.
Addthe changecoloreffectby25 blockintotheloop(from
the‘Looks’section),torepeatedlychangethecolourofthe
spaceshipasitmoves:
Clicktheflagtoseeyournewanimation.
Youcanalsomakeyourspaceshipgetsmallerasitmoves
towardstheEarth.
9©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Testoutyouranimation.Whathappensifyouclicktheflaga
secondtime?Doesyourspaceshipstartofftherightsize?
Canyouusethisblocktofixyouranimation:
Saveyourproject
10©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Step3:FloatingMonkey
Let’saddmonkeytoyouranimation,who’slostinspace!
ActivityChecklist
Startbyaddinginthemonkeyspritefromthelibrary.
Ifyouclickonyournewmonkeyspriteandthenclick
‘Costumes’,youcanedithowthemonkeylooks.Clickthe
‘Ellipse’tool,anddrawawhitespacehelmetaroundthe
monkey’shead.
11©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Nowclick‘Scripts’,andaddthiscodetothemonkey,sothatit
spinsslowlyinacircleforever:
The forever blockisanotherloop,butthistimeonethat
neverends.
Clicktheflagtotestyourmonkey.You’llhavetoclickthestop
button(nexttotheflag)toendthisanimation.
12©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Step4:BouncingAsteroids
Let’saddsomefloatingspace-rocktoyouranimation.
ActivityChecklist
Adda‘rock’spritetoyouranimation.
Addthiscodetoyourrock,tomakeitbouncearoundthe
stage:
Clicktheflagtotestyourrock.Doesitbouncearoundthe
stage?
13©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Step5:ShiningStars
Let’scombineloopstomakeashiningstar.
ActivityChecklist
Adda‘star’spritetoyouranimation
Addthiscodetoyourstar:
Clicktheflagtotestoutthisstaranimation.Whatdoesthis
codedo?Well,thestarismadeslightlybigger20times,and
thenmadeslightlysmaller20times,backtoit’soriginalsize.
These2loopsareinsidea forever loop,sotheanimation
keepsrepeating.
Saveyourproject
14©RaspberryPiFoundation.UKRegisteredCharity1129409.TheseprojectsareforuseoutsidetheUKonly.Moreinformationatwww.codeclubworld.org.
ThiscourseworkisdevelopedonGitHub,atwww.github.com/CodeClub.
Challenge:Makeyourownanimation
Stopyourspaceanimation,andclick‘File’andthen‘New’,to
startanewproject.
Usewhatyou’velearntinthisprojecttomakeyourown
animation.Itcanbeanythingyoulike,buttrytomakeyour
animationmatchthesetting.Herearesomeexamples:
Saveyourproject