Scratch Advanced – Week 12 – Welcome back

What are we going to do this week:

1. Re Cap on the exam.

2. A Magic Eight Ball, Question and Answer Game.

3. Flow Charts – how to explain code with pictures 🙂

1. Re Cap on the exam

I though we might have a quick review of a couple of the questions from the Exam. There was one question that nearly everyone missed and I think it might have been the way I wrote the question, so we’ll just go over it quickly.

Question 8:

If you want two pieces of code to run together (parrallel processing) circle all the ones that you could use:

a. Broadcast

b Broadcast and wait

c. Green Flag

The Broadcast and wait will NOT run things in parallel, it will Wait for the other code to finsh before continueing.

2. A Magic Eight Ball, Question and Answer Game.

I thought we would use some of the List skills that we used in the Christmas Game to build a Magic Eight Ball type Question and Answer game.

So here are the requirements:

1. A Genie should appear from a Lamp.

2. There should be a friendly Sprite Character who will ask if you if you have any questions.

3. There will be a place to type in your Question

4. Questions can only be ones that have a Yes or No Answer.

5. A nice background to match your friendly Sprite

6. A random answer should be selected from the following list:

It is certain
It is decidedly so
Without a doubt
Yes – definitely
You may rely on it
As I see it, yes
Most likely
Outlook good
Yes
Signs point to yes
Reply hazy, try again
Ask again later
Better not tell you now
Cannot predict now
Concentrate and ask again
Don’t count on it
My reply is no
My sources say no
Outlook not so good
Very doubtful

I decided to use a Genie in the Desert, emerging from a Lamp to answer my Questions.

Here are my Sprites:

Genie

 

Lamp

 

 

 

 

And here is my stage:

Giraffe

 

 

 

The Code is Quite simple, again I have used the Stage as the Starting point for all the Code as I think this makes quite good sense as there is only one Stage, but generally many Sprites.

First we have to populate our Answer List with the different possible answers.

Then we can let the Genie know it is time to do the talking…

Now, I added the Lamp as, we need code under the Lamp to get things started. I decided that you should have to rub the Lamp to make the Genie appear. Once the Genie was out of the Lamp, we will let you ask the Genie a Question.

The code, well you know how to populate lists, so I’m not going to go through that.

For the Lamp, we need to check to see if the Mouse is touching the lamp and the Mouse Button is down, if it is we will keep counting up till we reach 10 and then let the Genie take over. We can do that with a Broadcast. But don’t forget that we also want the Genie to appear out of the Lamp, so as we are counting to 10, we need to make the Genie grow.

This is what I came up with…

LampCode

 

 

 

 

 

For the Genie, there are a few pieces of code, one to set him up, one to make him appear and grow, and finally the one where he gets you to ask a Question.

GenieCode

 

 

 

 

 

 

 

And finally, I came up with a third, invisible Sprite, but it allows the Giraffe on the background to say a few things as well. I came up with another list of things that he could say and populated those at the begining as well.

GiraffeCode

 

 

And I have been really kind and uploaded the finished Scratch Project onto the Scratch WebSite.

One thought on “Scratch Advanced – Week 12 – Welcome back

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s