First, let’s address the elephant in the room. You must be wondering why I used a LED matrix for the game display at a time where OLEDs and TFTs are the go-to displays for projects.(Even a Nokia 5110!-the game itself is retro enough, adding a Nokia tag in my project would have made it too old-school).
When I first started off, I bought it quite enthusiastically but never used it(this is not the only one though). So, I decided to do something with it(yes, this is the best I could come up with).
Why this game?
Simple. I wanted to have a score more than 11 in the Android version of this game. No wonder there are so many YouTube tutorials(yes, that’s a hack)/articles out there showing you how to score more. It has some serious gravity issues.
Pretty straight forward connections – a button for user input, and standard SPI connections.
The head and legs will occupy a pixel each.
THE GITHUB REPO
- It is confined in the 3rd(head) and 2nd(tail) column, oscillating there.
- Movement is governed by
up(uplift when the button is pressed)and
- The generation and sideways movement of the pipes are controlled simply by bit manipulation.
- All thanks to this awesome timer library which kept all the complexities hidden under the hood, and enabled me to implement the timer events viz,
Update(which updated the bird’s position),
Pipe1(/2)MoveTimer( pipe movement from right to left) with ease.
LIGHTING IT UP
- MAX7219 saved me both processor pins and processing time.
This LED driver, complemented by its library prevented the code from crossing 400 lines.
These were the crucial sections of the code.
Rest of the functions are mostly self-explanatory. I’ll put comments soon.
And finally, the game in action can be viewed here!
Here’s a few pictures of the project: