Give a word a name to use in the program using is. You can choose the name yourself.
Ask something with ask. Beware! You need to give the answer a name with is.
sleep let Hedy pause for a (couple of) second(s).
Give a number a name using is. You can choose the name yourself.
Introduction
is
Rock, paper, scissors
ask
Rock, paper, scissors 2
Haunted House
sleep
Parrot
Story
Restaurant
Turtle
Puzzle
Quiz
Congratulations! You've reached level 2. Hopefully you've already made some awesome codes!
In the first level you might've notice that the echo command can only save one bit of information at a time.
For example in the restaurant adventure, you could echo what the costumer wanted to eat, or what they wanted to drink, but not both in one sentence.
print Welcome at Hedy's
ask What would you like to eat?
echo So you want
ask what would you like to drink?
echo So you want
If the player types a hamburger and coke, you can't say "so you would like a hamburger and coke", but you have to make two separate line.
Also, the echo command only echoes the word at the end of the sentence. So you can't say "your hamburger is coming right up!".
That changes in level 2. In level 2 you'll learn to work with variables, that allow you to save multiple pieces of information and print them in any place you want.
So let's go to the next tab!
Variables
You can name a word with is. This is called a variable. In this example we made a variable called name and a variable called age. You can use the word name anywhere in your code and it will be replaced by Hedy, like this:
name is Hedy
age is 15
print name is age years old
Exercise
Time to make your own variables!
In the example code we made an example of the variable favorite_animals. In line 1 the variable is set, and in line 2 we haved used the variable in a print command.
Firstly, finish our example by filling in your favorite animal in the blanks. Then make at least 3 of these codes yourself. Pick a variable, and set the variable with the is command. Then use it with a print command, just like we did.
favorite_animals is _
print I like favorite_animals
In this level you can practise using the variables, so that you can make the rock, paper, scissors game in the next level!
Exercise
Finish the code by filling in the variable on the blanks.
This game is not very interactive, but no worries! In the next tab you'll learn how to use variables with the ask command to make your game interactive!
choice is rock
print I choose _
The ask command
Now that we can use variables in our codes, we no longer need the echo command.
We can use variables to store the answers to our questions and this way we can use the answer to multiple questions in our codes.
Check it out:
This way your code is becoming interactive!
name is ask What is your name?
print Hello name
age is ask How old are you?
print name is age years old.
Exercise
In the previous tab you have practised with setting variables with the is command.
You have created at least 3 variables and used them with a print command.
Now, instead of setting the variables we want you to make the variables interactive, like we did in our example.
Copy your code from the previous tab and make the variables interactive by using ask commands.
favorite_animals is ask What is your favorite animal?
print I like favorite_animals
Now that you have learned how to use the `ask command, you can make your rock, paper, scissors code interavtive too!
Exercise
Make the rock, paper, scissors code interactive by adding the ask command and a question to your rock, paper, scissors code.
choice is _
print I choose choice
In this haunted house you can choose your monsters with emojis. Of course you could also use words.
monster_1 is 👻
monster_2 is 🤡
monster_3 is 👶
print You enter the haunted house.
print Suddenly you see a monster_1
print You run into the other room...
print But a monster_2 is waiting there for you!
print Oh no! Quickly get to the kitchen.
print But as you enter monster_3 attacks you!
Exercise
In the example above the monsters are predetermined. So each time you run your code, the output is the same.
Can you add ask commands to make the haunted house interactive and have the players choose the monsters they come across?
monster_1 is _
monster_2 is _
monster_3 is _
print You enter the haunted house.
print Suddenly you see a monster_1
print You run into the other room...
print But a monster_2 is waiting there for you!
print Oh no! Quickly get to the kitchen.
print But as you enter monster_3 attacks you!
The sleep command
Another new command in this level is sleep, which pauses your program for a second. If you type a number behind the sleep command, the program pauses for that amount of seconds.
print My favorite colour is...
sleep 2
print green!
In the previous level you've made a parrot that will repeat after you. In this level we'll make the parrot interactive using a variable and ask command.
We will also make the parrot more life-like by adding sleep commands after something is said.
print Im Hedy the parrot
name _ _ what is your name?
print name
_
print squawk
_
print name
Exercise
Firstly, finish line 2 with an is and an ask command.
Then fill in a sleep command on line 4 and 6 to let the parrot stay quiet for a little bit.
Extra Can you make the parrot ask for more then only your name by adding more lines of code?
In level 2 you can make your story more fun. Your main character's name can now be anywhere in the sentence.
You do have to program a little bit extra for that. You must now name your main character first.
You can then put that name anywhere in a sentence.
name is ask What is the name of the main character?
print name is now going to run in the woods
print name is a bit scared
print Suddenly he hears a crazy noise...
sleep
print name is afraid this is a haunted forest
Exercise
Now it's time to add variables to your own story that you've made in the previous level.
Go to 'My programs', look for your level 1 story adventure and copy the code. Paste the code in your input screen in this level.
This code won't work in this level, because you have not used variables yet.
Change the ask commands and echo commands in your code to the correct form that you've learned in this level.
Extra Add a sleep command to your code to build up tension in your story.
In level 2 you could expand your restaurant by using variables. In level 1 Hedy could only echo the order once and only remember the last thing that was ordered.
Now you can use variables and Hedy can remember both the food and the toppings!
print Welcome to Hedy's restaurant!
print Today we're serving pizza or lasagna.
food is ask What would you like to eat?
print Great choice! The food is my favorite!
topping is ask Would you like meat or veggies on that?
print food with topping is on its way!
Exercise
Copy your own restaurant code from to previous level to the input screen below.
Fix the code by replacing the ask and echo commands and using variables, like you've learned in this level.
Now that your code is working again, it's time to add something more.
Look at the last line of the example code: print food with topping is on its way!
In this single line 2 variables have been used to create a summary of the order.
Now add your own summary of the food and drinks ordered by the customer.
Extra Now that you've learned how to use variables, you can use as many variables in one line as you'd like. Can you add more variables to your code, like eat in or take-away, cash or card, with or without a straw etc.?
In this level you can use variables to make the turtle interactive. For example you can ask the player how many steps the turtle must make.
answer is ask How many steps should the turtle make?
forward answer
Also, in level 1 the turtle could only turn left or right. That is a bit boring!
In level 2 he can point his nose in all directions.
Use 90 to turn a quarter. We call this degrees. A full turn is 360 degrees.
Exercise
Can you make a figure with this code? Maybe a triangle or a circle?