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

Post on 23-Jun-2020

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

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:

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

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?

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:

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

7TheseprojectsareforuseoutsidetheUKonly.Moreinformationisavailableonourwebsiteatwww.codeclubworld.org.

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

around,youcanplaythegameinfullscreenmodebyclicking

thisbutton:

Saveyourproject

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.

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

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

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.

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.

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