Catch the "Apples"

Hello, this week I am going to make a catching apples game through a micro:bit. Let’s see how it works below:
Drag the sprite bricks in the MakeCode drawer.
Create two sprites(One as the falling apple, another as the basket to catch the apples)
In on start brick, set the basket at the bottom side by fixing Y as 4 and X at a random value, here we assign 0 to it. And we set the apple at the top side by fixing Y as 0 and X at a random value (here we assign 0 to X).
Movement of the basket: Control it via the buttons and set them as below:
Apple's movement: After powering on, it moves down from the position (0,0). During this process, only the Y coordinate changes, while the X coordinate maintains the original value. To fall to the bottom, it needs to change to 1, 2, 3 and 4(four times in total), thus we use repeated execution in four times and increase its Y coordinate by 1. In this way, an apple lands off. After one finished progress, another needs to follow, set the Y coordinate of this sprite to 0 (back to the top), and take a random number from 0 to 4 for the X coordinate. In this way, when the apple returns to the top, it locates randomly and is displayed on the top 5 LED lights.
By judging whether the two sprites are in contact, you would know if the apple is catched(Here I give a sound feedback once the apple gets catched by the basket).
Completed program:
https://makecode.microbit.org/_VLP1ijMebJuF
If you have any ideas or opinions, please feel free to contact us via services@elecfreaks.com.
Share this post
About the Author

ELECFREAKS focuses on microbit and publishes interesting articles
Related Posts
Introduction to the history of the BBC micro:bit
New BBC micro:bit-micro:bit V2
How to make a meme with micro:bit ?
Topics
- Curriculum
- Course
- Micro bit supplier
- Wholesale Suppliers
- Micro bit tutorial
- Micro bit classroom pack
- Mcorbit Environment Monitoring
- Temperature-controlled
- Motor
- Fan
- TPBot car
- TPBot
- Micro:bit car
- AI Lens
- Micor:bit AI Lens
- Micro:bit LEDs
- BBC micro:bit
- Micro:bit Manipulator
- Wukong board
- Cutebot
- Micro:bit Motorcycle
- Nezha breakout
- Micro:bit DIY
- 360° servos
- AI Lens
- Retro Arcade
- Ecode
- PlanetX
- Microbit programming
- Your:bit
- Do your:bit
- IoT:bit
- Octopus
- Rainbow LED Ring
- Joystick:bit
- Wonder Building Kit
- Sensor:bit
- Downie
- Wenjie
- Laser Engraver Tutorial
Tags
Comments