Presentation is loading. Please wait.

Presentation is loading. Please wait.

Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.

Similar presentations


Presentation on theme: "Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other."— Presentation transcript:

1 Code Club Session 2 Dance Party

2

3 What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other using events

4 Backgrounds  Click the stage icon in scratch, it is the white box on the bottom right of the screen.  Now click the backgrounds.

5  We are now going to add in 5 backgrounds.  Click import, then select dance-1  Continue selecting dance-1 through to dance-5  You can also delete the white background

6  We now need to make the 5 backgrounds appear in sequence.  Click the stage icon, then click scripts  We now need to make the 5 backgrounds appear in sequence.  Click the stage icon, then click scripts.  Add the following commands, ask if you need help, or are not sure how to get the command on the screen.

7  Click the green flag.  How long will the background keep changing ?  How do we stop it ?

8 Music  A disco needs music !  Select sounds  Click Import  Select Music Loops  Select Kalimba  Delete pop

9  We now need to play the music  Make sure the stage icon is clicked, then click scripts  We are going to play the music in a forever loop.  Make sure that the sound command has the “until done” at the end.  Now click the green flag to see our disco  Don’t forget to click the red button to make it stop !

10 Animations  We now have our dance studio.  Next we have to add our dancers, to do this we will learn how to animate them to make it look like they are dancing.  What is an animation ?

11 Introducing Cassy !  Right mouse click the cat sprite and click delete  Next click the icon to create a new sprite  Select People  Then select “cassy-chillin”  Rename the sprite to read “Cassy”

12  We will now give Cassy some costumes, when these are displayed quickly it will make her look like she is dancing.  Make sure you have the Cassy sprite selected then click “Costumes”.  Click Import  Select the first Cassy-dancing picture  Click ok  Repeat the process until you have selected all of the Cassy dancing images.

13  Next we need to animate Cassy  First we always want Cassy to start with the same costume.  It is important for computer programs to initialise correctly.  Next we get Cassy to wait for 2 seconds  This is because she wants to listen to the beat before she starts.  Finally she starts to dance.  Select the repeat loop and change the number to read 20  Pull the next costume command down and place it in the repeat loop.  What happens when the green flag is clicked now ?  To slow the animation down we need to pause between each costume.  Add a wait for ½ second and click the green flag again.  Remember ½ a second is 0.5

14 Events  We now have Cassy dancing  Next we want to add another dancer  We will make them talk to each other  Then they will dance together  To do this we co-ordinate our two dancers using something called “Events”.  What is an event ?

15  First we will create a second dancer.  Click the “New sprite from file” icon.  If you are not already in the People folder, select it then select “breakdancer1”.  Rename the dancer, we will call him “dude”  The picture of the boy will have appeared on the screen.  Using the mouse drag the two dancers to move then apart

16  Next we will raise an event from the “Cassy” sprite when the dance has finished.  Make sure you have clicked Cassy  Then click Scripts  Add the broadcast event to the end of the block.  Next click the down arrow on the broadcast command  Then click “new”  Type in the name of the event. We will call ours “Dance finished”

17  We are now broadcasting an event when Cassy finishes her dance.  We now want “Dude” to react to that event.  Click the sprite “Dude”, the click scripts  Drag the “When I receive” command across. It will already have the name of the event we are listening for in it.  Next we want to do something when “Dude” hears the event.  Drag the following speech across.  Edit the text as shown.  Now click the Green Flag.  What happens when Cassy stops dancing ?  Don’t forget the red button stops !

18  We now need to let Cassy know we have asked a question.  Make sure you have clicked the “Dude” sprite.  Add a new broadcast event and add it to the end of the speech.  Click the drop down and select new.  Name the event “Want to dance ?”  Now click the “Cassy” sprite, then click scripts.  We want Cassy to respond to the question.  Add a new “When I receive” event and select the “Want to dance ?” event.  Add a “say” command to the event  Click the green flag !

19 How do our events communicate ?

20 Review  We’ve shown how you can change backgrounds  How you can animate a sprite  How you can raise and respond to events.

21 If we have time  We will get both Cassy and Dude dancing.  First import some new costumes for Dude.  Import costumes 2 though 4

22  Finally make sure that the scripts for Dude and Cassy are as shown below.  Note that we’ve added a new event that they both need to respond to.  Lets Dance !!!!!


Download ppt "Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other."

Similar presentations


Ads by Google