so_long
A small 2D game built with the MiniLibX graphic library in C, introducing window management, event handling, and textures.
2021-10-01

so_long
A top-down 2D game in C using MiniLibX. Navigate through a tile-based map, pick up all the collectibles, and get to the exit. The move count displays on screen after every step. Simple concept, but it covers a lot of ground: window management, keyboard events, sprite rendering, and map validation.
How to play
- W / A / S / D to move
- Collect everything before the exit unlocks
- Reach the exit tile to win
- Move count is shown on screen after each step
- ESC or close the window to quit
Map format
Maps are .ber text files. One character per tile:
| Char | Tile |
|---|---|
| 1 | Wall |
| 0 | Floor |
| P | Player start |
| E | Exit |
| C | Collectible |
Maps need to be rectangular, fully walled in, with exactly one P and one E, and at least one C.
11111
1P0C1
10001
1C0E1
11111
Technical notes
MiniLibX handles the window, events, and image rendering. Sprites are XPM images composited tile by tile. The map is stored as a 2D char array, read line by line with get_next_line. Validation runs before the window opens so bad maps never make it to the screen. Move count is drawn directly onto the window surface with ft_printf.
Bonus
The bonus version has enemy patrols and animated sprites. Enemies move along set paths, and the player character has a frame-by-frame animation.
make # base version
make bonus # with enemies and animations
./so_long maps/map.berSCREENSHOTS // 01 FRAMES
