▄████████ ▄██████▄ ▄█ ▄██████▄ ███▄▄▄▄ ▄██████▄
███ ███ ███ ███ ███ ███ ███ ███▀▀▀██▄ ███ ███
███ █▀ ███ ███ ███ ███ ███ ███ ███ ███ █▀
███ ███ ███ ███ ███ ███ ███ ███ ▄███
▀███████████ ███ ███ ███ ███ ███ ███ ███ ▀▀███ ████▄
███ ███ ███ ███ ███ ███ ███ ███ ███ ███
▄█ ███ ███ ███ ███▌ ▄ ███ ███ ███ ███ ███ ███
▄████████▀ ▀██████▀ █████▄▄██ ▀██████▀ ▀█ █▀ ████████▀
▀
so_long is a 42 School graphics project where the goal is to build a small 2D game in C using MiniLibX. The player must explore a map, collect every collectible, and reach the exit while respecting map rules and movement constraints.
This repository includes both the mandatory part and the bonus version, with extra animations, enemies, and a graphical move counter.
This project demonstrates:
- C programming fundamentals
- 2D rendering with MiniLibX
- map parsing and validation
- event-driven input handling
- path validation / solvability checking
- memory management
- game loop logic
- sprite animation and bonus gameplay systems
- Load and validate
.bermaps - Detect invalid shapes and map content
- Check that the map is closed by walls
- Ensure there is exactly:
1player (P)1exit (E)- at least
1collectible (C)
- Render the map in a graphical window
- Move the player using keyboard controls
- Count and display moves
- Allow exit only after collecting everything
- Validate whether the map is actually solvable before starting
- Animated player sprites
- Animated environment elements
- Enemy spawning and rendering
- Enemy movement/interaction systems
- Idle animations
- Graphical move counter using sprite digits
- More polished visual presentation
- Multiple sample maps for testing
So_Long_42/
├── inc/ # headers
├── img/ # in-game textures and xpm assets
├── graphical/ # source art / sprite resources
├── libs/ # libft + MiniLibX
├── maps/
│ ├── valid/ # working maps
│ └── invalid/ # invalid maps for testing parser rules
├── srcs/ # mandatory sources
├── srcs_bonus/ # bonus sources
└── Makefile # build rules
At startup, the program:
- checks if a map path was provided
- validates the
.berextension - reads the map into memory
- checks map shape and required elements
- validates that the map is playable
- initializes MiniLibX
- loads textures and sprites
- renders the game window and starts the loop
From your codebase:
srcs/main.chandles the mandatory startup flowsrcs_bonus/main_bonus.cextends that flow with:- animation setup
- enemy initialization
- graphical move display
- loop hooks for animated gameplay
A valid map must:
- have the
.berextension - be rectangular
- be surrounded by walls
- contain only valid characters
- contain exactly one player start (
P) - contain exactly one exit (
E) - contain at least one collectible (
C) - be solvable
1→ Wall0→ Empty floorP→ Player startC→ CollectibleE→ Exit
W→ Move upA→ Move leftS→ Move downD→ Move rightESC→ Exit the game- Window close button → Quit cleanly
This project is built for Linux with MiniLibX / X11.
You need:
ccmake- X11 development libraries
- local dependencies already included in
libs/
git clone https://github.com/PatzCM/So_Long_42.git
cd So_Long_42
makemake bonusmake cleanmake fcleanmake remake norminette./so_long maps/valid/map1.ber./so_long_bonus maps/valid/map1.berYou can replace map1.ber with any valid .ber map in the repository.
maps/valid/map0.bermaps/valid/map1.bermaps/valid/map2.bermaps/valid/map3.bermaps/valid/map4.ber
Useful for testing parser and validation errors:
maps/invalid/has_other_elem.bermaps/invalid/hole_in_wall.bermaps/invalid/map1.bermaps/invalid/not_rect.bermaps/invalid/only_c.bermaps/invalid/only_e.bermaps/invalid/only_e_and_p.bermaps/invalid/only_p.ber
This repository already contains visual assets in graphical/, including:
graphical/player.pnggraphical/collec.pnggraphical/exit.pnggraphical/a_exit.png
This project appears to use custom assets and sprite resources from folders such as:
graphical/idlegraphical/walk_upgraphical/walk_downgraphical/walk_leftgraphical/walk_rightgraphical/idle_zombiegraphical/z_upgraphical/z_downgraphical/z_leftgraphical/z_rightgraphical/walls
That gives the bonus version a much stronger game feel than a basic mandatory-only implementation.
- Main executable:
so_long - Bonus executable:
so_long_bonus - Uses local
libftfromlibs/libft - Uses local MiniLibX build from
libs/mlx - The Makefile includes a
norminettetarget - The project is primarily written in C with a Makefile build system
Patricia Monteiro
- GitHub: PatzCM
- Project: So_Long_42
This project is part of the 42 curriculum, where the objective is not only to make a working game, but also to apply strict coding rules, validation logic, graphics programming, and clean memory handling.
It reflects practical work in:
- structured C development
- algorithmic thinking
- low-level graphics handling
- debugging and validation
- transforming a small specification into an interactive project