Building Math Games using Scratch is a good example of project based learning - it is long term, collaborative, interdisciplinary, and has a real world application. Students must manage their own time to meet the deadlines provided.
The Math games require players to solve math problems that are randomly created. Solving problems correctly allows the user to advance to the goals - which varied from getting oxygen in an underwater world, shopping online to escaping from sharks. Students learn advanced programming skills like variables, conditionals, user inputs, random numbers, and messaging.
The Math games can be created in 5-8 classes of 30-40 minutes. Work outside class during lunch and home should be encouraged but is not required.
Engage: Discuss Math games they have played. Tell students they will be creating one themselves. Explain project mission and deadlines.
Set up pairs for Pair Programming. Explain Pair programming.(See below)
Activate: Place Mission and Tasks (shown below) on projector overhead or on class website/wiki
Mission: Create a fun game in Math
Deadline: Project must be completed in 6 classes (Date -)
- Project will be uploaded to the Scratch website and may be played by any student.
- School appropriate images, language are important
- Start with basic math - addition/subtraction and get the game working. Make math problem more difficult at a later stage.
- Create own backgrounds/character or customize Scratch images.
- Be creative!
Step 1: Choose / Draw/ Edit / Customize
- character or characters
Step 2: Decide on goals/rewards
- Reaching the planet
- Escaping a shark
- Getting to the end of the rainbow
Step 3: Decide on movement/ transitions to goal
- Rotations as it moves
Create a simple example with the class input, asking students to pick character/background. Show how the following blocks work and build a simple game with just one fixed question.
Create a working game using just one simple fixed question. Use the blocks below
Explain X-Y co-ordinates (control click on Goto block to start Scratch HELP)
Using game from Class 2, discuss why it is important to have all characters start from the start position when a game re-starts( The dog in the game is already closer to the beach ball when the game is played the second time). Show the blocks below and how Scratch pre-fills the X and Y positions.
Demonstrate with the same game, how the ball can change based on the responses from the user and why it is necessary for the dog (who is receiving the responses from the user) to communicate to the beach ball so it can change based on correct or wrong answers.
Dog sends the message - put this in the right part of the script for the Dog sprite
Beach ball/ crab gets the message - this is in the scripts for the ball sprite
The game built has only a fixed question. The questions must change each time to be interesting and there should be multiple questions. Explain random functions. Explain concept of variables as buckets that store information. Create 2 buckets (variables) called number1 and number2 and set them to the random values. To start, use simple numbers - single digit with random from 1 to 10. After testing, change this to larger numbers.
Explain the difference between the string '3+4' and the computed value '3+4' and discuss how one is used in the Ask block and the other as the comparison value to check the answer from the user.
Remind them about the use of the repeat and forever blocks to create multiple questions
Optional classes where students work to enhance the game. Encourage them to add scores, levels, a winning/losing screen. music etc.
Show related blocks on the overhead/class instruction site and help only as needed.
When the project is complete, explain the importance of testing,and ask them to get other students in the class to test their project. The students must enter detailed information on the game in Project Notes on how to play the game and the scoring system if any.
Ask students to find a partner (or help them find the appropriate partner for the project). Explain the roles below. Use only one computer, the other is not used.
Driver : controls mouse & keyboard
Navigator: Checks instructions, helps drive
Encourage them to switch roles often. Monitor that no student takes over and does the project on their own, both students should participate.