Upper Elementary
Computer Science
Click-a-Martian
Step-by-Step
Go to Clever. Login with your school email.
Open Code HS
Select the : Click and Martian Project
Objective
Students will be able to create an interactive Whack-a-Mole style game using conditionals, variables, booleans, and events.
Sample Project
Vocabulary
Conditional: A command that tells a program how to make a decision if something is true or false
?
Vocabulary
Variable: A container that can hold one value at a time
Vocabulary
Boolean: A value that can only be true or false
The "if/then" block is a way to make your sprite do something only if a certain condition is met. It's giving instructions: "If something is true, do this; otherwise, don't do anything."
In the program, the “if/then” block will be used to determine which Hole the Mole is going to.
“Operator” blocks are blocks that can complete math problems. The “comparison operator” blocks compare two values.
In the program, the “booleans” will tell the Mole what hole to go to and compare the score.
The “variables” blocks are like a box or a container that holds the value for the things in the program. A variable can only hold one value at a time, but that value can change over time.
In the program, the “score” and “hole” variable will be used to set the score and determine the hole the Mole is going to.
Starter Code
The parts of a program that are created for you are called Starter Code. We provided the backdrops and the mole sprite for you!
Make a prediction!
When Flag Clicked
This event resets the score.
Mars
When Sprite Clicked
This event changes the score
Begin programming the Mole to set up the game and create a Score variable.
Mars
0
Program the Mole to continue until a certain score is met, and create a Hole variable.
Repeat until the score is greater than 15. Or Pick your own score to win!
Mars
Add a conditional in the repeat to show something happen if the Mole is touching Hole 1.
Matches the holes location on the stage.
Time until the mole hides.
Mars
Embed an if/then inside the repeat until to show something happen if the Mole is touching Hole 2.
Matches the holes location on the stage.
Time until the mole hides.
Mars
1
1
Now it’s your turn!
Add a switch background to show you win when you reach above 10
Holes 3 and 4
Explain your code.
1
Now it’s your turn!
As you program, check for bugs!
Explore your game!
Are you ready for more?
Customize your game by adding on!
Option: Customize your background
Option: Customize your Sprite to make a Martian.
Reflection
How are the “Hole” and “Score” variables different?
Why isn’t the Hole variable visible on the stage?
Marshmallows for Martians
There was an Old Martian Who Swallowed the Moon