Top Banner
ACO 101 Making a program
47

ACO 101 Making a program. mb_your_brain_on_improv.html mb_your_brain_on_improv.html.

Jan 01, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

ACO 101

Making a program

Page 3: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Open Scratch

Page 4: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Right click and Delete the Cat object

Page 5: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Click the choose new sprite from file button

Page 6: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Pick a the crab animal [object]

Page 7: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Give it an instance name of “Crabby”

Page 8: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Make another sprite from file and pick the fairy from the fantasy folder

Page 9: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Name that object “Fairy”

Page 10: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Save the project as “FortuneTeller”

Page 11: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

In our fortune teller program the fairy will be the teller and the crab will be the

seeker

Page 12: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Select the seeker [crabby]

Page 13: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Variables palette, click the Make a list button.

Page 14: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

In the list name dialog box, type questions and select For this sprite only.

Page 15: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Click OK to create the list. Several new blocks display in the Variables palette, and an empty block titled seeker

questions displays on the stage.

Page 16: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Let’s think about a couple of questions we may be tempted to ask

• Will my hair fall out?• How many children will I have?• Creativity aerobics– Quickly think of 20 questions in the next 10

minutes

Page 17: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Click the plus sign located in the bottom-left corner of the seeker questions box (on the stage) to display a text

input field. Type Will my hair fall out?

Page 18: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Press the plus sign again and enter the second question

• How many children will I have? – We now have two questions in our list. • To automatically add the next item in the list, press

enter.

• Now add in the rest of your questions.

Page 19: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Here it is…

Page 20: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Let’s add a say for 2 secs [under looks] block to the scripts area of the seeker sprite so that we can start the

dialog.

Page 21: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Variables palette, drag the item of questions block to the input value of the say for 2 secs block.

Page 22: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Double-click on the block and the seeker asks, “Will my hair fall out?“

Page 23: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Change the value on the item block to last and double-click the block again. This time the seeker asks, “How

many children will I have?“

Page 24: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Create a list of answers for the fairy [teller]http://en.wikipedia.org/wiki/Magic_8_ball

Page 25: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Choose fairy and make a list

Page 26: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Right click and choose import

Page 27: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Browse and pick the text file

Page 28: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Here is the list of answers

Page 29: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Think of a new fortune

• that is not yet in your answers list. We are going to add it to the list.

• I’ll use “No comment” as my new fortune.

Page 30: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Now, let’s add the new fortune to our list. From the Variables palette, find the add block. Replace the default value thing with

your new fortune. Make sure the answers list is selected.

Page 31: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Double-click on the add block to add the new item to the end of the answers list.

Page 32: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

hide the lists from the stage by right-clicking on each list and selecting hide so that they are out

of the way.

Page 33: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

start with the seeker sprite

Page 34: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

We need a way to control our seeker. From the Control palette, drag the when space key pressed block and

attach it to the say block.

Page 35: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the position drop-down list in the item block, select any. Press thespace key to ask a question. Each time you press the space key, a

random question from the list displays.

Page 36: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

We need to let the teller know we’ve asked a question, and that we expect an answer. From the Control palette, add the broadcast block.

Page 37: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Add a new broadcast message titled fortune

Page 38: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Right click on broadcast

Page 39: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Here it is

Page 40: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Every question deserves an answer.

• Select the teller sprite so that we can create the script to provide an answer.

Page 41: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Right click and delete the add block

Page 42: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Control palette, drag the when I receive block into the scripts area, and make sure fortune displays as the message value.

Page 43: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Looks palette, add the say for 2 secs block to the when I receive block

Page 44: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Variables palette, add the item block as the input to the say block.

Page 45: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Numbers palette, add the pick random block as the position value of the

item block.

Page 46: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

From the Variables palette, add the length of block to the second value of the pick random

Page 47: ACO 101 Making a program.  mb_your_brain_on_improv.html  mb_your_brain_on_improv.html.

Press the space bar and watch it work.