https://github.com/simonefelici/so_long
2D game
https://github.com/simonefelici/so_long
Last synced: 19 days ago
JSON representation
2D game
- Host: GitHub
- URL: https://github.com/simonefelici/so_long
- Owner: SimoneFelici
- Created: 2025-02-01T15:50:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-25T18:58:26.000Z (3 months ago)
- Last Synced: 2026-03-26T19:30:04.502Z (3 months ago)
- Language: C
- Size: 492 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
*This project has been created as part of the 42 curriculum by sfelici.*
# so_long
## Description
so_long is a small 2D top-down game built in C using the MiniLibX graphics library. The player navigates a tile-based map, collecting all items before reaching the exit. The map is validated at launch using a Depth First Search algorithm to ensure a valid path exists. The project covers window management, event handling, textures, sprites, and basic gameplay logic.
Bonus features include enemy patrols that move when the player moves, a kill mechanic using a flint and steel (press `E` near an enemy), explosion animations, and a live move counter displayed on screen.
## Instructions
**Dependencies**
MiniLibX requires the following packages on Linux:
```
sudo apt install libx11-dev libxext-dev
```
**Build**
```
make
```
**Run**
```
./so_long maps/map.ber
```
The map file must use the `.ber` extension and follow these rules:
- Surrounded by walls (`1`)
- Contains exactly one player (`P`), one exit (`E`), and at least one collectible (`C`)
- Optionally contains enemy patrols (`V`)
- Must have a valid path from `P` to `E` through all `C`
**Controls**
| Key | Action |
|-----|--------|
| `W` `A` `S` `D` | Move |
| `E` | Attack adjacent enemy |
| `ESC` | Quit |
## Resources
- [MiniLibX documentation](https://harm-smits.github.io/42docs/libs/minilibx)