Geometry and STEM – Catch the Coins Game

0
Geometry and STEM - Catch the Coins Game

In this challenge we are going to code a game in which players must catch coins on the Micro:Bit.

Big Ideas:

  • Geometry – Location & Movement
  • Computational Thinking (breaking down problems)
  • Conditional Statements
  • Block coding

We will use the accelerometer as input to move the LED light patterns. To begin, we will create a sprite to represent the player as well as one to represent the coin. The player will always begin the game at position (2,2) which is centred on the Micro:Bit. The coins will appear at random.

 

screen-shot-2016-09-08-at-12-47-43-pm

 

The Micro:Bit LEDs consist of a 5 x 5 grid and make for a nice mini lesson around coordinates, Cartesian Plane and other properties of Geometry.

 

Screen Shot 2016-09-06 at 8.24.31 AM

I’m going to go ahead an also add some sounds as the game initalizes and create a countdown.

screen-shot-2016-09-08-at-12-46-03-pm

Next, we will code the accelerometer to detect the motion across the X axis. If the acceleration is in the positive range, we will increment the X value of the LED to make it move to the right.

 

screen-shot-2016-09-08-at-12-47-03-pm

Similarly, if the acceleration is to the left, we will decrement the X value to make the LED move to the left.

 

screen-shot-2016-09-08-at-12-47-09-pm

Repeat the process for Y.

screen-shot-2016-09-08-at-12-47-17-pm

Next, we will have to using some sensing to determine if the player sprite touches the coin sprite. If it does, increment our score variable by one and place a new coin at another random position.

 

screen-shot-2016-09-08-at-1-27-07-pm

Throw the conditional statements into a while loop and get ready to play!

screen-shot-2016-09-08-at-1-29-24-pm

 

Watch the video below to see the game in action!

 

For more lessons, activities and ideas, grab a copy of my book, Code Breaker, on Amazon here!

(Visited 889 times, 1 visits today)

Leave a Reply

Name
Name*
Email
Email *
Website
Website