Welcome to So_Long, a 2D game created using MiniLibX for a project at 42 School ! 🌟
Your mission ? Collect all items before finding the exit... but beware of lurking monsters
And Thanks for All the Fish !
- 2D View
- Objective: The player must collect all items on the map and escape via the shortest path.
- Player Movement: The player can move in four directions (up, down, left, right) and never through walls.
- Movement Counter in shell
- Random Floor Pattern: Ground textures are randomized, and external walls differ from the labyrinth walls inside the map.
- Character and Monster Animation: Both the player and monsters are animated during movement.
- Monsters: Monsters are programmed to pursue the player at all costs. If they encounter a wall blocking their path, they will attempt to find an alternative route to reach the player.
- Health Management: The player has three lives before dying.
- Turn-Based Mechanics: The player has as many moves per turn as remaining lives + 1, while monsters always have two moves.
- User Interface (UI): Displays move counter, item counter, lives remaining, and a turn banner indicating if it’s the player’s or monsters' turn.
Key | Description |
---|---|
ESC | Quit the game |
W or ⬆️ | Move up |
S or ⬇️ | Move down |
A or ⬅️ | Move left |
D or ➡️ | Move right |
Each map in .ber format should adhere to specific structural rules:
- The map is rectangular and closed by walls on all edges.
- Contains one 'P' (Start) and one 'E' (Exit).
- Items ('C') must be collectible, with a path allowing the player to reach all items before accessing the Exit.
- Only the characters shown in the table below are allowed:
Character | Description |
---|---|
P | Start point |
E | Exit point |
C | Item |
0 | Void / Flat |
1 | Wall |
M | Monsters |
-
include/
- Contains header files
-
src/
main.c
- Entry point of the programso_long.c
- Manages core game functionsgame/
- Contains gameplay logic, including player movement, item collection tracking,monster behavior, and win/loss conditions.map/
- Handles map-related functions, such as loading and validating .ber map files and checking paths for game elements like the exit and items.mlx/
- Manages the interface with the MiniLibX library, including creating windows, rendering textures, and updating the display.utils/
- Utility functions
-
textures/
- Contains the game's textures, stored in .xpm format
-
map/
- Directory for .ber maps, including both valid and invalid configurations for testing.
-
librairies
Dependencies
-
Libft: This project depends on my Libft. Automatically downloaded and installed when you run the make command.
-
MiniLibX: The MiniLibX library will be automatically downloaded and installed when you run the make command. Ensure you have the necessary
prerequisites
on your machine.
1. To compile, simply run the make
command:
This Makefile was generated by my generator available here: MakeMyFile
make
make bonus
make clean
make fclean
make re
2. After compiling, run the game with the following command:
./so_long [path/to/map.ber]
At 42 School, most projects must comply with the Norm.