So Long is a project from the 42 São Paulo Common Core curriculum. It involves creating a 2D game using the MiniLibX library, where a player navigates a map to collect items and reach an exit.
My implementation draws inspiration from the classic Pac-Man arcade game. Sprites were sourced from The Spriters Resource and adapted using Aseprite, a paid pixel art software, to adapt animations and fit the game design.
42 São Paulo is a tuition-free, global coding school focused on peer-to-peer learning and project-based education. This project introduces graphics programming and game development in C.
So Long implements a simple 2D game. The player moves through a map, collecting all items before exiting. It’s divided into:
- Mandatory Part: A basic game with player movement, movement counting, item collection, and exit functionality, using a rectangular map with walls, a player, collectibles, and an exit.
- Bonus Part: An enhanced version with additional features such as enemies, animations and movement count directly on the game screen.
- Player navigates the map using the arrow keys or W, A, S and D, collecting items to unlock the exit.
- Validates map integrity: rectangular shape, surrounded by walls, contains one player, one exit, and at least one collectible.
- Displays move count in the shell upon each movement.
- Uses MiniLibX for rendering graphics and handling events.
- Bonus:
- Displays the player's move count directly in the game window.
- Adds immobile enemies to the game (as a personal extra, I added a variety of enemies based on the original Pac-Man).
- Adds animations to the player and enemies..
- Written in C, compliant with the 42 Norm.
- No unexpected crashes (e.g., segmentation faults).
- No memory leaks from heap allocations.
- Compiled with
-Wall -Wextra -Werror. - Requires valid
.bermap files; invalid maps trigger an error message.
- C compiler (e.g.,
clang). makeutility.libftlibrary inlibs/libft.- MiniLibX library in
libs/mlx(Linux version). - X11 development libraries (
libxext-dev,libx11-dev).
-
Clone the repository:
git clone https://github.com/LuizGandra/so-long-42.git cd so-long-42 -
Build the mandatory part:
make
-
Run the game with a
.bermap file:./so_long maps/<map_name>.ber
-
Build the bonus part (optional):
make bonus
-
Run the bonus game:
./so_long_bonus maps/valid_map_bonus.ber
make clean: remove object files.make fclean: remove the program and object files.make re: rebuild everything.
includes/so_long.h: header for mandatory part.src/*.c: source files for so_long (e.g., main.c, map.c, render.c).maps/*.ber: pre-made map files for testing.bonus/includes/so_long_bonus.h: header for bonus part.bonus/src/*.c: source files for so_long_bonus (e.g., main_bonus.c, animations_bonus.c).Makefile: compilation automation.libs/libft/: directory for the libft library.libs/mlx/: directory for MiniLibX.
This project is part of the 42 curriculum and intended for educational use.

