code club session 2 dance party. what will we learn ? how to change the background how to create...

22
Code Club Session 2 Dance Party

Upload: rosanna-daniel

Post on 28-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

Code Club Session 2

Dance Party

Page 2: 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
Page 3: 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

What will we learn ?

How to change the background

How to create animations

How to make objects talk to each other using events

Page 4: 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

Backgrounds Click the stage icon in scratch, it is the white

box on the bottom right of the screen.

Now click the backgrounds .

Page 5: 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

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

Page 6: 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

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.

Page 7: 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

Click the green flag.

How long will the background keep changing ?

How do we stop it ?

Page 8: 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

Music A disco needs music !

Select sounds

Click Import

Select Music Loops

Select Kalimba

Delete pop

Page 9: 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

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 !

Page 10: 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

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 ?

Page 11: 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

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”

Page 12: 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

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.

Page 13: 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

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

Page 14: 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

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 ?

Page 15: 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

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

Page 16: 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

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”

Page 17: 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

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 !

Page 18: 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

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 !

Page 19: 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

How do our events communicate ?

Page 20: 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

Review We’ve shown how you can change backgrounds

How you can animate a sprite

How you can raise and respond to events.

Page 21: 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

If we have time We will get both Cassy and Dude dancing.

First import some new costumes for Dude.

Import costumes 2 though 4

Page 22: 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

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 !!!!!