A lightweight and modular 2D physics engine with sprite rendering for the M5Stack Cardputer. This project features real-time gravity simulation, AABB (Axis-Aligned Bounding Box) collision detection, and basic keyboard-controlled movement using the Cardputer’s built-in keyboard.
- Gravity simulation for all objects
- AABB collision detection & resolution
- Sprite rendering with
M5Canvas - Lightweight
- Easily extendable for simple 2D games or physics demos
Demo of two dynamic sprites colliding with gravity and keyboard movement
- M5Stack Cardputer
- USB-C Cable
- Arduino IDE with M5Stack libraries installed
Install these libraries via the Arduino Library Manager:
M5UnifiedM5GFXM5Cardputer
The engine uses a basic update-render loop running at ~70FPS. Objects are represented as simple structures containing position, velocity, and dimensions.
Collision is resolved with axis separation logic (AABB), and gravity is applied as a constant force each frame.
