Micro:bit Reaction Ability Test
Hello, today I will use micro:bit to make a simple reaction test game. There is a small bright spot on the LED matrix that moves left and right. When the bright spot moves to the middle, press the A button, if the bright spot is in the middle of the screen when the button is pressed, you will get one score, otherwise the game is over and the moving speed of the bright spot will continue to increase as the game progresses in order to increase the difficulty. GIF displays:
Principle:
The bright spot is a sprite that keeps moving back, forth, left and right. When A button is pressed, the micro:bit judges whether the x coordinate of the current bright spot is 2 or not. If it is 2, it means it is the target position. If not, the game is over. We need an additional variable to save the movement interval time of the highlight. Each time the player presses the right button, the movement interval will be shortened so that the highlight will move faster
Program:
Go to: makecode.microbit.org
Create a variable named as “lightspot”
1.While on start, create a spirit on the middle of the screen and assign it to the variable.
2.Create a new variable name as “time interval” and set it as 600.
1.In forever brick, set the lightspot keeps moving with 1.
2.Set the lightspot reverses once it touches the edge of the screen.
3.Pause time interval
1.Drad on button A pressed brick.
2.If x of the lightspot is 2, change the score with 1.
3.Set “time interval” as time interval – 50.
4.Or the game is over.
Full program:
Link: https://makecode.microbit.org/_V2b2AL9qpg1X
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