so_long is a 2D game developed as part of the 42 curriculum. The project involves creating a simple graphical game using the MiniLibX library, where the player collects items and reaches the exit while navigating through a map. This repository includes the mandatory part of the project and can optionally include bonus features.
- The player starts on the map and must collect all collectibles (
C) before reaching the exit (E). - The player navigates using the arrow keys or
W,A,S,D. - The game ends when the player reaches the exit after collecting all the collectibles.
- Display the game map as a grid of sprites.
- Handle player movement and ensure valid gameplay rules.
- Close the game properly when:
- The user presses the
ESCkey. - The user clicks the close button on the window frame.
- The user presses the
- Display movement count directly on the screen.
- Add animations for sprites.
- Introduce enemy patrols that cause the player to lose upon collision.
- macOS or Linux (MiniLibX is not natively supported on Windows).
- MiniLibX installed.
- X11 libraries (Linux) or XQuartz (macOS).
-
Clone the repository:
git clone https://github.com/leite-tiago/so_long.git cd so_long -
Compile the project:
make
-
Run the game:
./so_long <map_file>
- The map must be rectangular.
- It must contain:
- At least one player starting position (
P) - At least one exit (
E) - At least one collectible (
C)
- At least one player starting position (
- Walls (
1) must surround the entire map. - Other tiles should be empty space (
0).
Example map:
111111
1P0C01
100001
1C0E01
111111
so_long/
โโโ assets/ # Sprites for the game
โโโ include/ # Header files
โโโ src/ # Source code
โ โโโ main.c # Entry point
โ โโโ map.c # Map parsing and validation
โ โโโ game.c # Core game logic
โ โโโ render.c # Rendering logic
โ โโโ events.c # Event handling
โโโ Makefile # Build instructions
โโโ README.md # Project documentation
- MiniLibX - Graphics library.
- C programming language.
- Enhanced animations for more immersive gameplay.
- Complex enemy AI for challenging levels.
- Dynamic map resizing during gameplay.
This project is part of the 42 Network curriculum. Special thanks to the 42 community for guidance and support!
This project is licensed under the MIT License. See the LICENSE file for details.