Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
Meet Thirsty - String Operator in Scratch

# Meet Thirsty - String Operator in Scratch

Ratings: (0)|Views: 3,936|Likes:
A chapter in a new Scratch Project E-Book in progress. To download the demo project, please go to my site: http://shallwelearn.com
A chapter in a new Scratch Project E-Book in progress. To download the demo project, please go to my site: http://shallwelearn.com

### Availability:

See more
See less

05/11/2014

pdf

text

original

Meet Thirsty: String Operator inScratch
In this post, we will learn to use the string and the list features in Scratch. In thespirit of Shall We Learn, I will show you in a project. This project is called
I AmThirsty
. We will create a stick figure sprite as our main sprite; we will also a drinksprite. You can help this poor thirsty guy by moving the drink sprite to him with yourmouse. Then we will create many drink sprite based on the first drink sprite.First, create a new project and create a new sprite. If you don’t know how to do this,I recommend reading at least the first four lessons of Scratch Programmingavailable on this site.Name this sprite
Thirsty
. Here is mine. To demonstrate how to use the new
string
features in Scratch, let’s create avariable to hold the result string of adding all the names of the drinks he hasconsumed.Click the orange Variables button at the left panel and click
Make a variable
button. Enter “drink list” as the list name and keep this list visible for all sprites. Then click OK.

Create a broadcast message called “consumed”. This broadcast message will besent by the drink sprites later.Create scripts as shown below.
Thirsty
sprite sets
drink list
variable to an emptystring when the game starts, then it waits for the
consumed
drink list
variable for 2 seconds.Let’s move on to the drink sprite. Create a sprite or get one from Scratch library,and rename it to “tea”.

Select
tea
sprite’s Scripts tab, and create a
local variable
named “name”.Create the scripts as shown below. Note that you need to add a empty space beforethe “tea” so the result concatenated string looks right.