Scrolling map with animated sprite character. More...
Functions | |
| int | main (void) |
| Entry point — scrolling map with animated Mario. | |
Variables | |
| u16 | flip |
| Animation toggle (advance every other input frame) | |
| u16 | flipx |
| Horizontal flip flag (1 = facing left) | |
| u16 | frame |
| Current sprite tile number. | |
| u16 | frameidx |
| Current animation frame index (0-3) | |
| u8 | gfxsprite [] |
| 16x16 Mario sprite tiles (4 animation frames) | |
| u8 | gfxsprite_end [] |
| u8 | mapdata [] |
| Full level tilemap from tmx2snes. | |
| u8 | palsprite [] |
| Mario sprite palette. | |
| u8 | palsprite_end [] |
| static const u8 | sprTiles [4] = {0, 2, 4, 6} |
| Walk frame tile offsets: each 16x16 sprite = 2 tiles in VRAM. | |
| u8 | tileset [] |
| 4bpp tileset graphics | |
| u8 | tileset_end [] |
| u8 | tilesetatt [] |
| Tile collision attributes. | |
| u8 | tilesetdef [] |
| Metatile definitions. | |
| u8 | tilesetpal [] |
| Tileset palette (3 banks x 16 colors) | |
| u8 | tilesetpal_end [] |
| u16 | xloc |
| Mario X position in map pixels. | |
| u16 | yloc |
| Mario Y position in map pixels. | |
Scrolling map with animated sprite character.
A large Tiled map scrolls as a Mario sprite moves left and right. The map engine streams only the visible tiles to VRAM, so the map can be much wider than the screen. The sprite animates between 4 walk frames and flips horizontally based on direction.
This is the stepping stone between "static background" and "continuous_scroll" — it teaches the map engine basics with a simple player character.
Ported from PVSnesLib "mapscroll" example by alekmaul.
| int main | ( | void | ) |
Entry point — scrolling map with animated Mario.
| u16 flip |
Animation toggle (advance every other input frame)
| u16 flipx |
Horizontal flip flag (1 = facing left)
| u16 frame |
Current sprite tile number.
| u16 frameidx |
Current animation frame index (0-3)
|
extern |
16x16 Mario sprite tiles (4 animation frames)
| u8 gfxsprite_end[] |
|
extern |
Full level tilemap from tmx2snes.
|
extern |
Mario sprite palette.
| u8 palsprite_end[] |
|
static |
Walk frame tile offsets: each 16x16 sprite = 2 tiles in VRAM.
|
extern |
4bpp tileset graphics
| u8 tileset_end[] |
|
extern |
Tile collision attributes.
|
extern |
Metatile definitions.
|
extern |
Tileset palette (3 banks x 16 colors)
| u8 tilesetpal_end[] |
| u16 xloc |
Mario X position in map pixels.
| u16 yloc |
Mario Y position in map pixels.