Did this project help you? Give it a 🌟!
Version: 2.3. Bonus included.
A complete and straightforward implementation of So Long 42 project.
I use the /MLX42 library for many reasons detailed in its docs.
Efforts have been made to compartmentalize the code into functional parts: the program (/so_long), the maps management, graphics (tiles, animations, facade for graphic library), and events (keypress and game logic).
To keep the GitHub repository tidy and to avoid displaying library code, the lib
directory is archived. Follow the steps below to set up and run the project:
- Decompress the Libraries:
tar xzf lib.tar.gz && rm -rf lib.tar.gz
If needed, to re-archive :tar czf lib.tar.gz lib/ && rm -rf lib/
- Compile the Project:
make bonus
Note: The initial compilation can take a bit longer due to libraries. - Launch the Game:
./so_long_bonus assets/maps/classic_bonus.ber
- 12-frame animations for movements in all four directions.
- A move counter is displayed below the game scene.
- Implementation of static enemy patrols.
- End-game screens for both victory ("You win") and defeat ("Game Over").
- Dynamic tile sizing based on map dimensions.
- Can parse any size of the map, but large maps that cannot be displayed adequately (e.g., 420x190) will trigger a
Map is too large for display
error. The parsing can be seen by including an invalid block in the same map: theInvalid block
error will be properly raised (because parsing and checking are done before displaying).
- The bonus and mandatory components were developed concurrently. To comply with 42 correction rules,
make bonus
compiles the same code except two lines that recognize the enemy block as legit. It outputs the executable./so_long_bonus
. - Every allocated pointer is checked and stored by
track_allocation()
. In case of an error, the allocated pointer list is freed and the game is stopped. - To enhance code clarity, a facade pattern is employed when interfacing with MLX42.
- The existence of a valid path is checked by a Depth-first search algorithm.
Evaluated by 42 students (125%) and mentioned as an outstanding project 🎉.


