About • How to use • Mandatory • Bonus • Norminette • Contributing • License
This is a 2D game where the player navigates through a maze-like environment to reach a goal, avoiding obstacles and enemies. It is created using the MiniLibX library and I had to implement game mechanics, file input/output, and basic graphics.
- Subject
PDF
- References
GitHub
git clone git@github.com:jotavare/so_long.git
Important: To run the program, you need to download the MiniLibX.
cd so_long/so_long
make or make bonus
./so_long [map.ber]
./so_long_bonus [map_bonus.ber]
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 cleanly quit the program. - Clicking on the window cross must also close and quit the program cleanly.
- 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.
At 42 School, it is expected that almost every project is written following the Norm, which is the coding standard of the school.
- No for, do...while, switch, case, goto, ternary operators, or variable-length arrays allowed;
- Each function must be a maximum of 25 lines, not counting the function's curly brackets;
- Each line must be at most 80 columns wide, with comments included;
- A function can take 4 named parameters maximum;
- No assigns and declarations in the same line (unless static);
- You can't declare more than 5 variables per function;
- ...
- 42 Norms - Information about 42 code norms.
PDF
- Norminette - Tool to respect the code norm, made by 42.
GitHub
- 42 Header - 42 header for Vim.
GitHub
If you find any issues or have suggestions for improvements, feel free to fork the repository and open an issue or submit a pull request.
This project is available under the MIT License. For further details, please refer to the LICENSE file.