This is the So_Long project from the 42 school curriculum. So_Long is a simple 2D game where the player controls a character that must collect items and avoid enemies to win the game. The game is developed in a graphical environment using the MinilibX library.
- System Requirements
- Installation
- Compilation
- Usage
- Game Rules
- Project Structure
- Project Development Rules
- MinilibX library installed (provided in the 42 repository)
-
Clone the repository:
git clone https://github.com/siemeris/so_long.git
-
Navigate to the project directory:
cd so_long cd mac
Compile the project by running:
make
For bonus:
make bonus
Run the game with:
./so_long maps/map_valid.ber
For bonus:
./so_long_bonus maps/map_valid.ber
- The player starts at an initial position on the map.
- The goal is to collect all items and reach the exit to win.
- Avoid enemies, as they will deduct lives upon collision. (Bonus)
- The game ends when you collect all items and reach the exit or run out of lives.
The project structure is organized as follows:
src/
: Source code of the project, mandatory part.src_bonus/
: Source code of the project, extra part.maps/
: Example maps for the game.assets/
: Images used in the game.
make
- Compile so_long files.
make bonus
- Compile so_long_bonus files.
make all
- Compile mandatory + bonus files.
make clean
- Delete all .o (object files) files.
make fclean
- Delete all .o (object files) and .a (executable) files.
make re
- Use rules fclean
+ all
.
- Must use MiniLibX.
- Makefile must compile source files and should not relink.
- The program has to take as a parameter a map description file ending with the
.ber
extension.
- Goal: Collect every collectable and escape choosing the shortest route.
-
W
,A
,S
andD
keys must be used to move the main characterup
,down
,left
andright
. - Can't move into walls.
- Number of movements must be displayed in the shell.
- Must be a 2D view (top-down or profile).
- Doesn't need to be real-time.
- Display the image in a window and must remain smooth (changing windows, minimizing, ...).
- Pressing
ESC
must close the window and quit the program in a clean way. - Clicking on the window cross must also close and quit the program in a clean way.
- The use of the images of the MiniLibx is mandatory.
- The map should include 3 components to be constructed: walls, collectables and free space.
- Should be composed of only these 5 characters:
Characters | Description |
---|---|
0 |
Empty space. |
1 |
Wall. |
C |
Collectible. |
E |
Map exit. |
P |
Player starting position. |
- The map must contain 1 exit, at least 1 collectable, and 1 starting position to be valid.
- Map must be rectangular.
- Map must be closed/surrounded by walls. If not, the program should return an error.
- Check if there is a valid path in the map.
- The program must be able to parse any kind of map, as long it respects the rules.
- If an error/misconfiguration is encountered, it should return
Error\n
followed by an explicit message.
Map .ber
example:
111111111111
1001000000C1
100000011101
1P0011E00001
111111111111
- Develop original extra features (optional).
- Make the player lose when they touch an enemy patrol.
- Add sprite animation.
- Display the movement count directly on the screen, instead of writing in the shell.
This project adheres to the coding standards enforced by the Norminette tool at 42 School. Norminette ensures consistency in coding practices, covering aspects such as indentation, formatting, and function naming. By following these standards, we aim to enhance code clarity and maintainability.