scratch 1 balloons - codeclub.selco.info · one simple way to get lots of balloons is just to...

13
1 These projects are for use outside the UK only. More information is available on our website at www.codeclubworld.org. This coursework is developed in the open on GitHub, at www.github.com/CodeClub. Come and join us! Activity Checklist Test your Project Save your Project All Code Clubs must be registered . By registering your club we can measure our impact, and we can continue to provide free resources that help children learn to code. You can register your club at codeclubworld.org. Introduction You are going to make a balloon-popping game! Follow these INSTRUCTIONS one by one Click on the green flag to TEST your code Make sure to SAVE your work now Balloons Scratch 1

Upload: others

Post on 23-Jun-2020

7 views

Category:

Documents


0 download

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