Skip to content

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.

License

Notifications You must be signed in to change notification settings

siemeris/so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

So_Long Project - 42

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.

bonus

Table of Contents

  1. System Requirements
  2. Installation
  3. Compilation
  4. Usage
  5. Game Rules
  6. Project Structure
  7. Project Development Rules

System Requirements

  • MinilibX library installed (provided in the 42 repository)

Installation

  1. Clone the repository:

    git clone https://github.com/siemeris/so_long.git
  2. Navigate to the project directory:

    cd so_long
    cd mac

Compilation

Compile the project by running:

make

For bonus:

make bonus

Usage

Run the game with:

./so_long maps/map_valid.ber

For bonus:

./so_long_bonus maps/map_valid.ber

Game Rules

  • 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.

Project Structure

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.

Project Development Rules:

Makefile Rules:

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.

Mandatory:

  • 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.

Game:

  • Goal: Collect every collectable and escape choosing the shortest route.
  • W, A, S and D keys must be used to move the main character up, down, left and right.
  • 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.

Graphic Management:

  • 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.

Map Components

  • 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.

Map Validation:

  • 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

Bonus

  • 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.

Norminette Compliance

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published