Making your own handheld games is made much easier with [David Johnson-Davies’] simple sprite routines for the Adafruit PyBadge and PyGamer boards. Sprites can be thought of as small, fixed-size graphical objects that are drawn, erased, moved, and checked for collision with other screen elements.
xorSprite()
plots an 8×8 sprite, moveSprite()
moves a given sprite by one pixel without any flicker, and hitSprite()
checks a sprite for collision with any screen elements in a given color. That is all it takes to implement a simple game, and [David] makes them easy to use, even providing a demo program in the form of the rolling ball maze shown here.
These routines work out-of-the-box with the PyBadge and PyGamer, but should be easy to adapt to any TFT display based on the ST7735 controller. The PyGamer is the board shown here, but you can see the PyBadge as it was used to create an MQTT-enabled conference badge.
If you really want to take a trip down the rabbit hole of sprite-based gaming graphics, you simply can’t miss hearing about the system [Sprite_TM] built into the FPGA Game Boy badge.
I like C++ on embedded systems, especially with LEON and STM32 although there was a time folks at IAR cared nothing for hobbyists coding at their spare time… When their only experience of humanity was a toilet seat coming at them down a steel corridor.
Boy, that post went a bit nonlinear there at the end. 🙂