Transcript
Page 1: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

1TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

ActivityChecklist

TestyourProject

SaveyourProject

AllCodeClubsmustberegistered.Byregisteringyourclubwecanmeasureourimpact,andwecancontinuetoprovidefreeresourcesthathelpchildrenlearntocode.Youcanregisteryourclubatcodeclubworld.org.

IntroductionYouaregoingtomakeaballoon-poppinggame!

FollowtheseINSTRUCTIONSonebyone

ClickonthegreenflagtoTESTyourcode

MakesuretoSAVEyourworknow

BalloonsScratch

1

Page 2: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

2TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Step1:Animatingaballoon

ActivityChecklist

StartanewScratchproject,anddeletethecatspritesothat

yourprojectisempty.YoucanfindtheonlineScratcheditor

atjumpto.cc/scratch-new.

Addinanewballoonsprite,andasuitablestagebackdrop.

Addthiscodetoyourballoon,sothatitbouncesaroundthe

screen:

Page 3: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

3TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Step2:Randomballoons

Testoutyourballoon.Doesitmovetooslowly?Changethe

numbersinyourcodeifyouwanttospeeditupabit.

Didyoualsonoticethatyourballoonflipsasitmovesaround

thescreen?

Balloonsdon’tmovelikethis!Tofixthis,clickontheballoon

spriteicon,andthenclicktheblue i informationicon.

Inthe‘rotationstyle’section,clickthedottostoptheballoon

rotating.

Testyourprogramagaintoseeiftheproblemisfixed.

Saveyourproject

Page 4: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

4TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

ActivityChecklist

Withthecodeyouhavenow,yourballoonwillalwaysstartin

thesameplaceandmoveinthesamepath.Clicktheflaga

fewtimestostartyourprogram,andyou’llseeit’sthesame

everytime.

Insteadofusingthesamexandypositioneachtime,youcan

letScratchchoosearandomnumberinstead.Changeyour

balloon’scode,sothatitlookslikethis:

Ifyouclickthegreenflagafewtimes,youshouldnoticethat

yourballoonstartsinadifferentplaceeachtime.

Youcouldevenusearandomnumbertochoosearandom

ballooncoloureachtime:

Whathappensifthiscodeisputatthestartofyourprogram?

Doesanythingdifferenthappenifyouputthiscodeinsidethe

forever loop?Whichdoyouprefer?

Page 5: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

5TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Challenge:Morerandomness

Canyoumakeyourballoonstartbypointinginarandom

direction(between-90and180)?

Step3:Poppingballoons

Letsallowtheplayertopoptheballoons!

ActivityChecklist

Saveyourproject

Saveyourproject

Clickonyourballoonsprite,andthenclickthe‘Costumes’tab.

Youcandeletealloftheothercostumes,justleaving1balloon

costume.Addanewcostume,byclicking‘Paintnewcostume’

andcreateanewcostumecalled‘burst’.

Makesurethatyourballoonswitchestotherightcostume

whenthegamestarts.Yourcodeshouldnowlooklikethis:

Page 6: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

6TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Toallowtheplayertoburstaballoon,addthiscode:

Testoutyourproject.Canyoupoptheballoon?Doesitwork

asyouexpected?You’llneedtoimprovethiscode,sothat

whentheballoonisclicked,itshowsthe‘burst’costumefora

shorttime,andisthenhidden.Youcanmakeallofthishappen

bychangingyourballoon whenspriteclicked codetothis:

Nowthatyou’redeletingtheballoonwhenit’sclicked,you’llalso

needtoadda show blocktothestartofthe whenflag

clicked code.

Trypoppingaballoonagain,tocheckthatitworksproperly.If

youfinditdifficulttopoptheballoonwithoutdraggingit

Page 7: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

7TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

around,youcanplaythegameinfullscreenmodebyclicking

thisbutton:

Saveyourproject

Page 8: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

8TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Step4:Addingascore

Let’smakethingsmoreinterestingbykeepingscore.

ActivityChecklist

Tokeeptheplayer’sscore,youneedaplacetoputit.A

variableisaplacetostoredatathatcanchange,likeascore.

Tocreateanewvariable,clickonthe‘Scripts’tab,select

Data andthenclick‘MakeaVariable’.

Type‘score’asthenameofthevariable,makesurethatitis

availableforallsprites,andclick‘OK’tocreateit.You’llthen

seelotsofcodeblocksthatcanbeusedwithyour score

variable.

Page 9: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

9TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Step5:Lotsofballoons

Popping1balloonisn’tmuchofagame,solet’saddlotsmore!

Onesimplewaytogetlotsofballoonsisjusttoright-clickontheballoon

spriteandclick‘duplicate’.ThisisOKifyouonlywantafew,butwhatifyou

You’llalsoseethescoreinthetop-leftofthestage.

Whenanewgameisstarted(byclickingtheflag),youwantto

settheplayer’sscoreto0.Addthiscodetothetopofthe

balloon’s whenflagclicked code:

Wheneveraballoonispopped,youneedtoadd1tothescore:

Runyourprogramagainandclicktheballoon.Doesyourscore

change?

Saveyourproject

Page 10: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

10TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

need20?or100?Areyoureallygoingtoclick‘duplicate’thatmanytimes?

ActivityChecklist

Amuchbetterwayofgettinglotsofballoonsistoclonethe

balloonsprite.

Dragyourballoon whenflagclicked code(exceptthe score

block)offoftheevent(don’tdeleteit),andinsteadaddcode

tocreate20balloonclones.

Youcannowattachthecodeyou’vejustremovedtothe when

Istartasaclone event.Youshouldalsoreplacethe hide

blockintheballoon-clickingscriptwitha deletethisclone

block.

Yourballooncodeshouldnowlooklikethis:

Testyourproject!Nowwhentheflagisclicked,yourmain

balloonspritewillhideandthencloneitself20times.When

eachofthese20clonesisstarted,theywilleachbounce

aroundthescreenrandomly,justastheydidbefore.Seeifyou

canpopthe20balloons!

Saveyourproject

Page 11: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

11TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Step6:Addingatimer

Youcanmakeyourgamemoreinteresting,byonlygivingyourplayer10

secondstopopasmanyballoonsaspossible.

ActivityChecklist

Youcanuseanothervariabletostoretheremainingtimeleft.

Clickonthestage,andcreateanewvariablecalled‘time’:

Thisishowthetimershouldwork:

Here’sthecodetodothis,whichyoucanaddtoyourstage:

Toaddthe repeatuntil time =0 code,firstyou’llneedto

dragagreen = block,ontoyour repeatuntil block:

Thetimershouldstartat10seconds;

Thetimershouldcountdowneverysecond;

Thegameshouldstopwhenthetimergetsto

0.

Page 12: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

12TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Youcanthendragyour time variableontothe = block:

Dragyour‘time’variabledisplaytotherightsideofthestage.

Youcanalsoright-clickonthevariabledisplayandchoose

‘largereadout’tochangehowthetimeisdisplayed.

Testyourgame.Howmanypointscanyouscore?Ifyour

gameistooeasy,youcan:

Testyourgameafewtimesuntilyou’rehappythatit’sthe

rightlevelofdifficulty.

Givetheplayerlesstime;

Havemoreballoons;

Maketheballoonsmovefaster;

Maketheballoonssmaller.

Page 13: Scratch 1 Balloons - codeclub.selco.info · One simple way to get lots of balloons is just to right-click on the balloon sprite and click ‘duplicate’. This is OK if you only want

13TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

Challenge:Moreobjects

Canyouaddinotherobjectstoyourgame?Youcanaddgood

objects,likedonuts,thatgiveyoulotsofpoints,orbadobjects,

likebats,thattakepointsaway.

You’llneedtothinkabouttheobjectsyou’readding.Think

about:

Ifyouneedhelpaddinganotherobject,youcanreusethe

stepsabove!

Saveyourproject

Howmanywilltherebe?

Howbigisit?Howdoesitmove?

Howmanypointswillyouscore(orlose)forclickingit?

Willitmovefasterorslowerthantheballoons?

Whatwillitlook/soundlikewhenit’sbeenclicked?

Saveyourproject


Top Related