# Geometry and STEM – Catch the Coins Game

0

## 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.

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.

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

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.

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

Repeat the process for Y.

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.

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

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

(Visited 899 times, 1 visits today)