A 2D game built in C using MiniLibX, developed as part of the 42 School curriculum.
The goal is to create a small graphical game where a player collects items, avoids enemies (bonus), and reaches the exit.
The project focuses on graphics programming, event handling, and map validation.
- 2D map rendering using MiniLibX
- Player movement with keyboard input
- Collectibles, walls, and exit tiles
- Valid path validation for every map
- Frame rendering and window management
- Error handling and memory management
- Enemy movement and collision detection
- Animations for player, collectibles, and enemies
- Extra sprites and dynamic elements
- Improved visual experience
- C – Core language
- MiniLibX – Rendering and event handling
- Libft – Utility functions
- Makefile – Build and management
- GCC 11 – Required compiler
Important
The project will not compile with GCC > 11
- X11 libraries – For graphics on Linux
- MiniLibX – Already included in repo
- Libft – Already included in repo
- Clone the repository:
git clone https://github.com/Felipp3san/42-so_long.git
cd 42-so_long- Compile the project:
make # Compile mandatory version
make bonus # Compile bonus version./so_long maps/maps_with_no_enemies/valid_map.ber- The
.bermap file defines the layout of the game. - The player can move using W, A, S, D.
- The goal is to collect all items and reach the exit.
./so_long maps/maps_with_no_enemies/valid_map.berThis loads the map valid_map.ber and starts the game.
./so_long_bonus ./maps/maps_with_enemies/map_20x10_enemies.berRuns the bonus version with enemies, animations, and additional features.
Each map is a .ber file containing:
| Symbol | Meaning |
|---|---|
1 |
Wall |
0 |
Floor |
C |
Collectible |
E |
Exit |
P |
Player start |
X |
Enemy (bonus) |
Example:
111111
1P0C01
1000E1
111111
- Build the mandatory executable:
make- Build the bonus executable:
make bonus- Remove object files:
make clean- Remove all binaries and rebuild:
make re.
├── include/ # Header files
├── src/ # Source files
│ ├── mandatory/ # Core game source files
│ └── bonus/ # Bonus version source files
├── libft/ # Custom Libft library
├── mlx/ # MiniLibX library
├── build/ # Object files (created after compilation)
└── maps/ # Example map files
Educational project under 42 School academic policy.