https://github.com/pin3dev/42_so_long
2D tile-based game developed in C using MiniLibX. Features include map parsing from .ber files, flood fill path validation, sprite-based rendering, basic animations, and keyboard input handling.
https://github.com/pin3dev/42_so_long
2d-game 2d-game-engine 2d-graphics 42 42-so-long 42school common-core flood-fill so-long
Last synced: 6 months ago
JSON representation
2D tile-based game developed in C using MiniLibX. Features include map parsing from .ber files, flood fill path validation, sprite-based rendering, basic animations, and keyboard input handling.
- Host: GitHub
- URL: https://github.com/pin3dev/42_so_long
- Owner: pin3dev
- Created: 2023-05-22T21:52:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-08T15:00:22.000Z (6 months ago)
- Last Synced: 2025-08-08T17:12:48.682Z (6 months ago)
- Topics: 2d-game, 2d-game-engine, 2d-graphics, 42, 42-so-long, 42school, common-core, flood-fill, so-long
- Language: C
- Homepage:
- Size: 397 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
so_long
Introduction •
Structure •
Docs •
Cloning •
Usage •
Norms •
Contributors
The **so_long** project is a 2D game development challenge in which the player navigates a small map collecting collectibles and reaching an exit. The game integrates basic pathfinding logic, pixel graphics, and interactive gameplay using the **MiniLibX** graphical library.
This project aims to teach foundational game mechanics, graphics rendering, and algorithmic logic in a constrained environment, aligning with the [42 School](https://42.fr/en/homepage/) guidelines.
The **so_long** project has the following core components:
- **Game Mechanics**: Player movement, collectible items, and an exit condition.
- **Map Parsing**: The game loads a map from a `.ber` file, validating its format and structure.
- **Graphics**: The game renders the map using MiniLibX, handling animations, sprites, and user inputs.
- **Error Handling**: Proper error messages for invalid maps or gameplay interruptions.
- **Pathfinding**: Ensures the player can always reach the exit.
The project is implemented with modular code for readability and maintainability.
For detailed documentation, including function breakdowns and implementation notes, visit the following link:
To clone this repository and compile the project, use the following commands:
```bash
git clone https://github.com/pin3dev/42_so_long.git
cd 42_so_long/so_long
```
This will download the project to your local machine. Once inside the `42_so_long` directory, you can compile and run the game using the provided `Makefile`.
### Makefile
A `Makefile` is provided to simplify the compilation process. The Makefile includes the following rules:
- `all`: Compiles the project.
- `clean`: Removes object files.
- `fclean`: Removes object files and the executable.
- `re`: Recompiles the entire project from scratch.
To compile the project, run:
```bash
make
```
This will generate the `so_long` executable.
### Running the Game
To start the game, provide a valid `.ber` map file as an argument:
```bash
./so_long assets/maps/OK/m1.ber
```
The player can move using **arrow keys**, collect all collectibles, and reach the exit to win the game.
### Example Map File
A valid `.ber` file looks like this:
```
1111111
1P0C1E1
1000001
1111111
```
Legend:
- `1`: Wall
- `0`: Empty space
- `P`: Player
- `C`: Collectible
- `E`: Exit
## ⚠️ Norms and Guidelines Disclaimer
This project adheres strictly to the [**42 Norm**](https://github.com/pin3dev/42_Cursus/blob/main/norme.en.pdf) coding guidelines. These guidelines enforce specific coding styles and practices, shaping the implementation of the project accordingly.