Buy:
|
What's your superhero name? (Scratch)
How it works
The classic superhero (or super villain) name is made up of two words. These usually start with an adjective (a ‘describing word’) followed by a noun (a ‘naming word’). For example:
Adjective
Super Black Wonder Green Black |
Noun
Man Panther Woman Lantern Widow |
This program works by picking a picking a random adjective, followed by a random noun and combining the two words to create a superhero name.
Try it:
Try it:
Tutorial
In this tutorial, you will code a “Superhero” name generator in Scratch. This program works by picking a picking a random adjective, followed by a random noun and combining the two words to create a superhero name.
Step 1 - Sorting hat challenge
Look at the sample code (below) and try to work out what the code is doing. Click play button (right) to see if you where right.
In this tutorial, you will code a “Superhero” name generator in Scratch. This program works by picking a picking a random adjective, followed by a random noun and combining the two words to create a superhero name.
Step 1 - Sorting hat challenge
Look at the sample code (below) and try to work out what the code is doing. Click play button (right) to see if you where right.
Challenge 1
Sample code:
https://scratch.mit.edu/projects/622233705
- Click on the link (code for a simple sorting hat) below then modify it by changing some of the house names.
Sample code:
https://scratch.mit.edu/projects/622233705
Step 2
Question: Can you spot a problem with your code?
Fixing your code
Did you notice that your program never picked Dumbledore?
Let's take a look at the first line to see what the problem is.
- Add a new house to their list called 'Dumbledore' and run the code several times and make a list of all the outcomes.
Question: Can you spot a problem with your code?
Fixing your code
Did you notice that your program never picked Dumbledore?
Let's take a look at the first line to see what the problem is.
Notice that our code picks a random number between one and four. However, our list now contains five items.
Challenge 2
Hint: You will need to change the last number in the first line!
Part 3
What if we keep adding to the list or we are not sure how many items are in our list?
We can get around this problem by returning the length of the list. For example:
Challenge 2
- Modify your code so that it now also picks Dumbledore from the list.
Hint: You will need to change the last number in the first line!
Part 3
What if we keep adding to the list or we are not sure how many items are in our list?
We can get around this problem by returning the length of the list. For example:
Challenge 3
Extra Challenge
- Modify your code so that it picks a random number between one and the length of the list (see example above).
Extra Challenge
- Modify your code so that it picks a name at random from your whole class.
Superhero name generator
Remember: This program works by picking a picking a random adjective, followed by a random noun and combining the two words to create a superhero name.
Challenge
Using the partially completed example below, create your very own superhero name generator.
Example:
Remember: This program works by picking a picking a random adjective, followed by a random noun and combining the two words to create a superhero name.
Challenge
Using the partially completed example below, create your very own superhero name generator.
Example:
Partially working example (containing missing elements of the code):
https://scratch.mit.edu/projects/622246026
https://scratch.mit.edu/projects/622246026
Extra Challenge
- Change the superhero sprite or create your own superhero / super villain character.
- Animate your superhero sprite by using a sprite with more than one costume.
- Add in a random pause so that it looks like the superhero sprite is thinking before revealing the answer.
Bonus Challenge
- Create your own name generator. For example, elf name or game name generator etc.