A simple 2D video game written in C.
Find a file
2025-11-21 17:09:50 +00:00
include Fixed Libft. Main project should be done. 2025-11-16 18:46:29 +00:00
media Added proper readme, need to configure image. 2025-11-21 17:05:12 +00:00
sprites Added sprites, with the CC BY-NC-ND 4.0 license. 2025-11-18 12:37:41 +00:00
src Fixed error messages to be more in line with subject. 2025-11-19 18:44:24 +00:00
tests Added a last test for the project. 2025-11-19 11:19:13 +00:00
.gitmodules Added libs. 2025-10-21 16:20:26 +01:00
LICENSE Initial commit 2025-10-07 16:55:06 +01:00
Makefile Fixed Libft. Main project should be done. 2025-11-16 18:46:29 +00:00
README.md Updated readme to display the image. Fantastic! 2025-11-21 17:09:50 +00:00

🕹️ 42-so_long 🕹️

A simple, 2D mini videogame, written in C.

"So long, suckas!"

How to Play

See Building for more information.

You are a Pumpkin working for a Bubble Tea Stand during Halloween.

Demo.png

But Halloween is coming to an end, and an Evil Santa Claus stole all your Bubble Tea, because Christmas is around the corner. You must now retrieve all your Bubble Tea Cups that Evil Santa left behind, and return them to your Bubble Tea Stand to end this year's Halloween on a good note.
You need to collect all Bubble Tea before you can return to your stand!

Starting the game:

See Running for more information.

Open up a terminal, and run ./so_long followed by the name of your map. All maps must have the .ber extension ir order to be read by the game.
There are a handful of maps to choose from on the tests directory. For example, you can run the test1.ber map like this:

./so_long tests/test1.ber

Controls:

Use W, A, S, D or the arrow keys to control your character.

Each time you press one of the keys to move, a move counter will trace your number of moves on your terminal.
The game will close once you reach the Bubble Tea Stand, but only if you've collected all Bubble Tea Cups!

Making your own custom map:

The program will accept any map, so long (pun intended) as it respects the following criteria:

  • The map must be rectangular, and must be exclusively enclosed by walls.
  • It can only have one Player.
  • It can only have one Bubble Tea Stand.
  • It must have at least one Bubble Tea Cup.
  • It can have walls as an obstacle to the Player, but they must not block access to any Bubble Tea Cup or to the Bubble Tea Stand.
  • It must not have any random spaces/characters above or below the map.

Here's an example of a map for reference:

111111
100001
1P0011
11C0E1
111111

Where 1 represents walls/trees, 0 represents traversable floor, and P, C, and E represent the Player, a collectable Bubble Tea Cup, and the Bubble Tea Stand respectively.

Running

This game is made exclusively for GNU/Linux operating systems. It uses a graphics library, called Minilibx, which leverages the X Display Server.
With this in mind, you'll need a Linux distribution running either on bare metal or on a Virtual Machine. You should also be able to get it running on Windows Subsystem for Linux (WSL).

Building

No binary releases are provided, so you'll need to build this program yourself.
This program was developed with Ubuntu 22.04 as the targetted platform, but you should be able to compile it on any distro.
It should also be possible to start a Distrobox with a Ubuntu 22.04 container and build there.

Prequisites:

On a Ubuntu environment, install the following dependencies:

sudo apt install clang gcc git libxext-dev libbsd-dev make xorg zlib1g-dev

Clone this repository using Git, cd into it, and pull all dependencies:

git clone https://git.the-wired.org/TreezZ/42-so_long.git && cd 42-so_long && git submodule update --init --recursive

Once that's done, run GNU Make on the root of the repository to build the source code into a runnable binary:

make

The make clean and make fclean flags are also available to clean up the files created during compilation, as well as the binary, from the repository.

Licensing

All code in this repository is licensed under the terms of the GNU GPL-2.0-or-later. You can find it inside src.

The sprites used in this project are made by Rorororo, who published them under the terms of the CC BY-NC-ND 4.0 license.
You can find them inside sprites. This folder includes unused sprites I ended up not using in the project.

In addition, 2 libraries are used, found inside include:

Other Info

This project was done as part of the curriculum of 42. Grade achieved: 100/100

Lastly, I would like to give a special thanks to Rorororo for creating the sprites and the concept especially for this project.