Guess Physical version of Flappy Bird
, an international hit game, remains lively remembrance to everyone. Today, I'm gonna share with you a similar physical little game: physical version parkour. Let’s proceed right into the business by firstly referring to the APP. I’ll show you how to implement the whole physical game, hope to get your precious suggestions for v2.0 improvement. My vision is to make a simple-enough-to-assemble development kit.
Here comes the base frame and the roller designed by our 3D printer. But it looks quite hilarious that we were unable to find the perfect polish rod, so I use a 2B pencil instead for the moment.
The central point of this APP game is to get users control two characters bounces simultaneously, the number of characters increases with the growth in difficulty, maybe four or five. Our prototype v1.0 is currently one character available, but the frame of v2.0 is under designing, ideally should realize multiple game characters bounces and, moreover, allow two gamers to battle against each other. Unfortunately, the 3D design file is still in lock because we’re accelerating the process of v2.0 development and v1.0 graph is covered. But no worry, it’ll be uncovered soon. Just take a glance at v1.0.
This is a parkour game. There is a matchstick man (sliding block) and a button, you should control the matchstick man to hurdle over obstacles (black line) by using the button, it’s game over if the matchstick man hit any obstacle.
How to Play
Power up, it will display “press key” on LCD1602, then press the key, it’s has two second countdown then game starts;
When LCD1602 displays “Go” on the first line and your game time length on the second line, you’re in the game. The matchstick man will jump when you press the key, which does not support long press, in other words, even though you long press the key, the matchstick just jumps once;
Game over if the matchstick man hits an obstacle. LCD1602 will display “Game over” on the first line and the time length on the second line.
Prepare: L298 motor driver (you can also use other motor driver), infrared emitting diode and phototransistor module, LCD1602, button, servo, motor, wheel, conveyor(paper), crabstick, UNO and so on;
You can use a 3D print model, then assemble it like this:
3. Connect with MCU
It requires a pulse whose cycle is 20ms to control servo, and high level time is 0.5ms-2.5ms, there is a 180 degree servo as an example, the control map is:
3.2 Infrared Emitting Diode and Phototransistor Module
A small current goes through Q1 when the reflector is black, and the voltage of the second pin of LM358 is close to power voltage, and larger than the reference voltage of the third pin of LM358.LM358 outputs a low level on the first pin and vice versa.
4. Reference Code
We have used two libraries: Servo and LiquidCrystal. We will upload Servo and LiquidCrystal. You can download LiquidCrystal from here, or you can input this address in your browser: http://elecfreaks.com/store/download/SPI_IIC_LCD.zip
Please click here
to get the codes.