A step-by-step guide to working with sprites in PixelRoot32 Game Engine. This tutorial covers the three sprite bit-depth formats supported by the engine: 1BPP (monochrome), 2BPP (4 colors), and 4BPP (16 colors).
A demo scene displaying all three sprite types side by side:
- Left: 1BPP monochrome ship sprite (green-tinted)
- Center: 2BPP character sprite with 4-color palette
- Right: 4BPP detailed sprite with 16-color palette
The example demonstrates sprite creation, palette configuration, and entity integration within the PixelRoot32 scene system.
This tutorial builds upon the PixelRoot32 Hello World Tutorial. Before starting, you should be familiar with:
- Creating and managing scenes (init/update/draw lifecycle)
- Basic entity usage
- PlatformIO project setup
- Building for both native (PC) and ESP32 targets
If you haven't completed the Hello World tutorial, start there first to understand the engine fundamentals.
# Clone the repository
git clone https://github.com/PixelRoot32-Game-Engine/pixelroot32-sprite-tutorial.git
cd pixelroot32-sprite-tutorial
# Build for PC (native)
pio run -e native
# Build for ESP32
pio run -e esp32dev| File | Description |
|---|---|
src/SpritesTutorialScene.h |
Scene class header |
src/SpritesTutorialScene.cpp |
Scene implementation with sprite entities |
src/main.cpp |
Entry point |
src/assets/ |
Sprite data header files |
| Format | Colors | Best For |
|---|---|---|
| 1BPP | 2 | Simple icons, text, shapes |
| 2BPP | 4 | Classic retro sprites |
| 4BPP | 16 | Detailed graphics, UI elements |
- PixelRoot32 Game Engine - Core engine repository
- Hello World Tutorial - First tutorial in the series
- Engine Documentation
- Game Samples
Combine sprite rendering with the input system from the Hello World tutorial to make sprites respond to button presses. This is the foundation for building your first interactive game!