Skip to content

ulsgks/so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Minimalist So Long

Did this project help you? Give it a 🌟!

🕹️ General information

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).

🚀 Set-up

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:

  1. 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/
  2. Compile the Project: make bonus
    Note: The initial compilation can take a bit longer due to libraries.
  3. Launch the Game: ./so_long_bonus assets/maps/classic_bonus.ber

🎛️ Features

  • 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: the Invalid block error will be properly raised (because parsing and checking are done before displaying).

🛠️ Implementation details

  • 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.

📋 Testing

Evaluated by 42 students (125%) and mentioned as an outstanding project 🎉.

✨ Illustrations

classic_bonus bigest game_over

About

Made with the great MLX42. All bonuses included. Minimalist design & complete code.

Topics

Resources

Stars

Watchers

Forks