so_long is a project from the 42 curriculum that involves creating a simple 2D game using the MiniLibX library. The objective is to navigate a player through a map, collecting items and reaching an exit while adhering to specific constraints.
This project focuses on developing the following skills:
- Parsing and handling 2D arrays
- File reading and validation
- Rendering graphics with MiniLibX
- Event-driven programming (keyboard hooks)
- Memory management and error handling
The game requirements include:
- Development in C with no memory leaks
- Exclusive use of MiniLibX for rendering
- Graceful handling of invalid maps and errors
- Grid-based 2D gameplay
- Player movement via keyboard inputs
- Collectible items and an exit point
- Comprehensive map validation and error handling
- A Linux-based operating system
-
Clone the repository:
git clone https://github.com/yahyaeb/so_long.git cd so_long -
Compile the project:
make
-
Run the game:
./so_long maps/map.ber
Having issues? Check the Troubleshooting section.
- W: Move up
- A: Move left
- S: Move down
- D: Move right
- ESC: Exit the game
- The map must be a
.berfile. - It must be rectangular and surrounded by walls (
1). - It must include:
- It must include:
- At least one player (
P) - At least one collectible (
C) - Exactly one exit (
E)
- At least one player (
Example map:
111111
1P0C01
1000E1
111111
1: Wall0: Empty spaceP: Player startC: CollectibleE: Exit
- Collect all the stars before the exit becomes accessible.
-
"Can't find a suitable X11 include directory"
Ensure the required X11 development libraries are installed:sudo apt update sudo apt install libx11-dev libxext-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
-
"Cannot find -lbsd: No such file or directory"
Install the development version oflibbsd:sudo apt install libbsd-dev
-
Error related to
ft_printf
Navigate to theft_printffolder and rebuild:make re
- Yahia El Boukili - GitHub Profile
