Skip to content

2D'game where the objective is gather all the targets in order to escape of the map. ๐Ÿ•น๏ธ ๐ŸŽฎ ๐Ÿ‘พ

License

Notifications You must be signed in to change notification settings

alexhiguera/So_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

74 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—         โ–ˆโ–ˆโ•—      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— 
โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—        โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• 
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘        โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ–ˆโ•—
โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘        โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
โ•šโ•โ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• 

game img

So Long ๐Ÿ•น๏ธ

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.

Project Description ๐Ÿ“–

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.

Requisites โš ๏ธ

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 ๐Ÿ’€

Usage ๐ŸคŸ

Once compiled, run the program, and you can interact with the window using the keyboard.

  1. Clone this repository to your local machine.
git clone https://github.com/alexhiguera/So_long.git
  1. Run the compilation command to generate the executable and run game:
make play

Sprites ๐ŸŽž๏ธ

The images of the sprites must be in .xpm format. If you want to create your sprites, follow these steps:

  1. Find or create sprites in any image format.
  2. 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).
  3. Transform to the .xpm format through Convertio.

Controls ๐ŸŽฎ

KEY OBJECT
W or โฌ†๏ธ Move up
A or โฌ…๏ธ Move left
S or โฌ‡๏ธ Move down
D or โžก๏ธ Move right
Q or Esc Close the game

Map ๐Ÿ—บ๏ธ

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

game img

About

2D'game where the objective is gather all the targets in order to escape of the map. ๐Ÿ•น๏ธ ๐ŸŽฎ ๐Ÿ‘พ

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published