- 2D Gameplay: Embark on a journey in the world of 'So Long' where the player's objective is to collect all the items scattered throughout the map and then find the exit to escape. Beware of traps and enemies!
- Sprite Animation: All sprites in the game are animated.
- Game Over Screen: Whether you win or lose, there will be a game-over screen with a message displayed.
- Player Dialogue: The player has some random dialogue that gets displayed to the screen every now and then.
- Map Customization: Create your own custom maps. Learn more here.
- Error Handling: The game is equipped to handle any map misconfigurations, unexpected exits or malloc fails.
- Documentaiton: All functions are documented using doxygen comments to facilitate the understanding of the underlying logic.
- Movement: Move with W, A, S, and D keys.
- Movement count: Displays the total number of moves the player has done on screen.
- Enviroment: The map may contain 1 enemy, multiple mimics and traps.
- The game opens in a new window.
- Fluid window operations like minimizing, transitioning to another window, etc.
- Quick exit the game by pressing ESC or the close button.
- The game supports the current map elements:
1
for walls.0
for empty space (ground).D
for enemy patrol.P
for starting player position.M
for mimic enemy.C
for collectable.E
for exit.T
for trap.
- For the map to be "valid". The following have to be true:
- There must be 1 player (
P
). - There must be atleast 1 collectable (
C
). - There must be 1 exit (
E
). - The map must be rectangular.
- The map must be surrounded by walls.
- The map must be solvable (e.g. The player (
P
) cannot be surrounded by walls). - The map file must end with
.ber
.
- There must be 1 player (
Here is an example of a vaild map:
1111111111111
1C010T000T0C1
1000011111001
1P0011ET00001
1111111111111
Ensure you have cmake and glfw installed. You can check via: cmake --version
. If there is a version number, you good to go.
- Install brew if you don't have it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install cmake
brew install cmake
brew install glfw
sudo apt update
sudo apt install -y cmake
sudo apt install libglfw3-dev
- Clone the repository
git clone https://github.com/RealConrad/42so-long.git
- Enter the directory and build everything
NOTE: this project has git sub-modules of MLX42 and 42c-library. Running
make
will clone these repositories.
cd 42so-long
make
- Start the game
Replace the second argument with the map file path:
./so_long <map-file-path>
./so_long ./maps/valid/level3.ber
If you encounter any problems, don't hesitate to open a new Issue and I will get back to you ASAP.
- Incorrect brew folder:
Type
ld: warning: directory not found for option '-L/Users/<user>/.brew/opt/glfw/lib/'
which brew
in a terminal, and change the the BREW variable in the MakefileAlso change the Makefile variable (BREW = <your-brew-directory>
MLX_FLAGS
) to where your glfw is installed.-L"/Users/$(USER)/$(BREW)/opt/glfw/lib/"