Platformer with diagonal slope collision detection. More...
#include <snes.h>#include <snes/map.h>#include <snes/object.h>#include "mario.h"#include "res/tiles.inc"#include "res/mario_sprite.inc"Functions | |
| int | main (void) |
| Main entry point – slope collision platformer demo. | |
Variables | |
| u8 | mapmario |
| Map data (tile indices for the level layout). | |
| u8 | objmario |
| Object layer data (entity spawn positions and types within the map). | |
| u8 | tilesetatt |
| Tile attribute table (encodes slope angles and collision flags per tile). | |
| u8 | tilesetdef |
| BG1 tileset tile data (4bpp) – start label. | |
Platformer with diagonal slope collision detection.
Demonstrates the object engine's objCollidMapWithSlopes() function for handling diagonal terrain in a tile-based platformer. The SNES has no hardware support for collision, so slope detection is done in software by reading tile attribute tables that encode slope angles per tile (flat, 45-degree, half-slopes).
Uses the full OpenSNES game stack: map engine for scrolling, object engine for entity management, and dynamic sprite engine for animated character rendering. Mario walks, jumps, and slides on slopes with gravity-based physics.
Port of the PVSnesLib slopemario example by Nub1604.
| int main | ( | void | ) |
Main entry point – slope collision platformer demo.
Initializes the map engine with slope-aware collision data, registers the Mario object type, loads map and object layers, and enters the game loop. The main loop pipeline is:
objCollidMapWithSlopes() is called internally by Mario's update callback to handle diagonal terrain traversal.
|
extern |
Map data (tile indices for the level layout).
|
extern |
Object layer data (entity spawn positions and types within the map).
|
extern |
Tile attribute table (encodes slope angles and collision flags per tile).
|
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 (maps tile index to visual properties)