"And thanks for all the fish!"
A top-down 2D puzzle game built with MiniLibX as part of the 42 School curriculum. Guide your character through increasingly complex maps, collect all coins, avoid deadly bats, and escape before it’s too late!
- Move with WASD or arrow keys
- Collect all
C(coins) before reaching the exitE - Walls
1are impassable - Movement counter displayed in terminal
- On-screen movement counter (no need to check terminal!)
- Animated bat enemies that:
- Fly freely across the map
- Randomly change direction
- Kill the player on contact
- Bidirectional teleportation:
- Step on any
Ttile to instantly warp to anotherTtile - Teleporters are consumed on landing, not departure
- Supports 2+ warp points — warp from 1→2, then 3→1, etc.
- Step on any
- Game over screen with black background and red text
- Win screen with green centered message
- Start the game with:
./so_long - Play through 9 progressively harder levels
- Automatic level progression upon victory
- Final victory screen after completing all levels (I could not manage to see that one.. )
- Replay from any level without passing previous levels, from level 0 -> 8
fe :./so_long 6starts at level 7 ending at level 9 (8)
Maps use these characters:
1— Wall (impassable)F— false Wall (Player cleans tile by passing.., bats can fly over and reveal secret passage)0— Empty spaceP— Player start positionC— Collectible coinE— Exit (must collect all coins first)B— Bat spawn point (bonus)T— Warp (Teleporter) tile (bidirectional, random destination between available warp points - be aware of bat presence at possible destinations!!!)
Example:
11111111
1P0T00C1
10B00001
100000E1
11111111
make
./so_long maps/map_of_your_choosing.bergit checkout multi-level-play
make
./so_long # No map argument needed — plays all 9 levels automaticallymake bonus && ./so_long| Key | Action |
|---|---|
| W / ↑ | Move up |
| A / ← | Move left |
| S / ↓ | Move down |
| D / → | Move right |
| ESC | Quit game |
| Window Close (X) | Quit game |
- ✅ Norminette compliant (25 lines max per function, no forbidden functions)
- ✅ No memory leaks (Valgrind clean)
- ✅ All heap memory properly freed
- ✅ No undefined behavior or crashes
- ✅ Bonus features in separate files (
bonus.c,bonus_bis.c, etc.) - ✅ Uses only allowed functions: MiniLibX, libft, ft_printf, standard C
Tested on Ubuntu 22.04 with MiniLibX Linux version from 42 School repository.
- Custom 32x32 pixel art for player, enemies, and teleporters
- Smooth 5-frame bat animation
- Clean, readable UI with on-screen counter
Dodge bats, warp through dimensions, and conquer all 9 levels!
Good luck — and watch out for those bats! 🦇
