Scrolling platformer with object engine and enemy AI. More...
#include <snes.h>#include <snes/map.h>#include <snes/object.h>#include "kit.h"#include "insect.h"#include "automaton.h"#include "res/tiles.inc"#include "res/kit.inc"#include "res/insect.inc"#include "res/automaton.inc"#include "res/skyline.inc"Functions | |
| int | main (void) |
| Main entry point – scrolling platformer with map and object engines. | |
Variables | |
| u8 | maplevel |
| Map data (tile indices for the scrolling level layout). | |
| u16 | nbobjects |
| Shared sprite palette for all entity types (BGR555). | |
| u8 | objlevel |
| Object layer data (spawn positions and type IDs for entities). | |
| u8 | tilesetatt |
| Tile attribute table (collision flags per tile index). | |
| u8 | tilesetdef |
| BG1 tileset tile data (4bpp) – start label. | |
Scrolling platformer with object engine and enemy AI.
Demonstrates the OpenSNES map engine and object engine working together to create a scrolling platformer with multiple entity types. The map engine handles tile-based scrolling and VRAM streaming, while the object engine manages entity lifecycle, physics, collision callbacks, and per-frame update dispatch.
Three object types are registered from C: Kit (player-controlled, slope collision), the robot insect and the patrol automaton (both patrol between two x read from the map's object layer, and turn at each end). Object spawn positions are loaded from the map's object layer. The level is roofs with ramps at 45 and 22.5 degrees and vents to jump over, the far towers behind on BG2.
The dynamic sprite engine handles animated 32x32 sprites with automatic VRAM tile management, freeing the game logic from manual tile uploads.
This began as the PVSnesLib mapandobjects example by Alekmaul; the level, its tiles and the three characters are ours (devtools/art_assets/build.py writes the level from assets/neo-lumen/).
| int main | ( | void | ) |
Main entry point – scrolling platformer with map and object engines.
Initializes the map engine (BG1 tileset + tilemap), object engine (entity registration and spawning), and dynamic sprite engine (animated 32x32 sprites). The main loop follows the standard OpenSNES game pipeline:
Active display: mapUpdate() + objUpdateAll() + sprite end-frame VBlank: mapVblank() + oamVramQueueUpdate()
Object callbacks (Kit, the insect, the automaton) handle their own physics, collision, animation, and sprite drawing within objUpdateAll().
|
extern |
Map data (tile indices for the scrolling level layout).
| u16 nbobjects |
Shared sprite palette for all entity types (BGR555).
Running count of active objects in the level.
Initialized to 1 (Kit is always object 0) and incremented as enemies are loaded from the map's object layer by objLoadObjects().
|
extern |
Object layer data (spawn positions and type IDs for entities).
|
extern |
Tile attribute table (collision flags per tile index).
|
extern |
BG1 tileset tile data (4bpp) – start label.
BG1 tileset tile data – end label (for size calculation)
BG1 tileset palette (BGR555, 16 colors)
Tile definition table (visual properties per tile index)