โโโโโโโโ โโโโโโโ โโโ โโโโโโโ โโโโ โโโ โโโโโโโ
โโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโโ
โโโโโโโโโโโ โโโ โโโ โโโ โโโโโโโโโ โโโโโโ โโโโ
โโโโโโโโโโโ โโโ โโโ โโโ โโโโโโโโโโโโโโโโ โโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โโโโโโโโ โโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโ โโโ โโโโโ โโโโโโโ
This project is part of the 42 School curriculum. It is the fifth project, although it is the first graphic project in the Cursus. The project aims to create a 2D video game
using the graphic library MiniLibX
from the campus and the C language.
In this project, I use the MiniLibX
graphic library to create a window, manipulate images, and work with keyboard events. This library is a reduced and adapted version of OpenGL
.
It involves a series of validations for the map passed as an argument, checks to prevent memory leaks, game engineering, managing windows, events, sprites, and maps.
In my case, I set the challenge of making it run on MACos
, Linux
, and Windows11
, although at the moment, Windows
is unsupported. For this challenge, I had to create the game on MACos and later adapt it to Linux, since MiniLibX
was originally built for MACos
, and when adapting it to Linux
, most functions and hooks had their names changed or even their forms.
If you want to download my repo and try it out, you must consider your operating system.
- ๐ Macos -> In this operating system it is not necessary to download anything previously, since we access the OpenGL API.
- ๐ง Linux -> currently no version available, sorry ๐ฅฒ
- ๐ช windows -> it was to much, seriusly ๐
Once compiled, run the program, and you can interact with the window using the keyboard.
- Clone this repository to your local machine.
git clone https://github.com/alexhiguera/So_long.git
- Run the compilation command to generate the executable and run game:
make play
The images of the sprites must be in .xpm
format. If you want to create your sprites, follow these steps:
- Find or create sprites in any image format.
- Resize them in any editing program to
64px x 64px
. (64px
is not arbitrary; my project is defined like that, check what you need in your case). - Transform to the
.xpm
format through Convertio.
KEY | OBJECT |
---|---|
W or โฌ๏ธ |
Move up |
A or โฌ
๏ธ |
Move left |
S or โฌ๏ธ |
Move down |
D or โก๏ธ |
Move right |
Q or Esc |
Close the game |
You can create another map if you wish, as it can analyze any type of map, as long as it follows these rules:
- The map must be a .ber file.
- It can only contain these characters:
- It must be rectangular and surrounded by walls.
- The map must contain at least one exit, one collectible, and an initial position.
OBJECT | CHAR |
---|---|
Wall | 1 |
Coin | C |
Exit | E |
Player | P |
Floor | 0 |
See some examples in the /assets/maps folder ๐บ๏ธ.
ejemplo:
11111111111
10C0P1C0011
10000100001
1C0000C0001
111C01E00C1
11111111111