What's your elf name? In this Christmas project we create an "Elf Name Generator" that tells you your elf name based on the first letters of the first and last names.
In this project an elf will ask you what your first and last names are. Then using the first letter of each of your names, it will look up lists and put together what your elf name is.
The starter project that you will use has 3 lists already setup:
When you tell the elf your first name, he will get the first letter of your name and get index number of it in the alphabet list.
For example if your name is David, he will get the letter D and then lookup in the alphabet list what the index number for D is, which is 3. Then he can get the number 3 item in the first names list which is 'Mistletoe'.
index | 'alphabet' list | index | 'first names' list |
0 | A | 0 | Reindeer |
1 | B | 1 | Plum pudding |
2 | C | 2 | Holly |
3 | D | 3 | Mistletoe |
4 | E | 4 | Pine |
5 | F | 5 | Candy canes |
And then the elf will do the same thing using the first letter of your last name and the 'last names' list.
We've created a starter project that has the 3 lists already created. Open this starter project by clicking on the following link:
Add the Winter backdrop from the backdrop library.
To add a backdrop from the backdrop library follow these steps:
You can use search box or the filter links (Fantasy, Music, Sports etc) to locate your backdrop.
Included with this step is a picture of an elf. Save it to your computer and then upload it into your project as a new sprite.
You can upload images and sprite files into your project. To upload a sprite follow these steps:
The new sprite will upload into your project and appear in the stage area.
We need to create 2 variables:
Create the 2 variables and then add the following code to the elf sprite to start off the elf name variable as blank.
In the Variables palette, create a new variable by clicking the 'Make a Variable' button.
Once you click this button a box will appear asking what you want to call your variable. Give it a name that reminds you what you will be using it for. For example, if you wanted to keep track of your score in a game, you would create a variable called 'score'.