/So_long

Two-dimensional video game development project with C and the use of MLX42 library.

Primary LanguageCMIT LicenseMIT

🕹 So_long - 42 Proyect

A great but simple 2D game in C

GitHub code size in bytes Code language count GitHub top language GitHub last commit

# so_long

so long 42_preview

This is a small game project from 42school implemented using MLX42 ( a version customized of MiniLibX).

✏️ Goals

This project is a very small 2D game. It is built to make you work with textures, sprites. And some very basic gameplay elements. One part of most difficult goal of this project is to implement the flood fill algorithm, to find a valid path taking into account the special characters and the exit. Initiating the reading of a file full of characters using funtions from our own library, we load the file and apply to each character, a parsed imagen(texture) using funtions from the MLX42 library.

Getting Started

🚨 Please check that you have glfw installed in your machine. 
$ You can instal in Macos with brew install glfw

🛠️ Install and making

$ make

🛠️ Usage

$ ./so_long [MAP_FILE.ber]

Only map files with extension .ber are available. Map file examples are available in the maps/ directory.

$ ./so_long maps/map.ber

Run the code to use all the features of the game.

⚠️ Parser and checks

The program must not have errors in differents input parameters:

  • The numbers of characters in all rows must be the same.
  • Only characters allowd are " 0, 1, C, P, E ".
  • Must have a single player, and only one exit, and minimum one collectible.
  • The egdes of the maps must be closed, have walls.
  • The program checks the arguments, and the extension if finish in ".ber".
  • The wrong characters in input or wrong characters does not segmentation failure.

🚨 Validation path

One of the most complicated part of this proyect, is to apply a an algorithm to validate than the map and the game is possible to complete. For this part of program, apply an algorithm called "flood fill", which applied to a copy of the map evaluate that it is possible, to collect the objects and after them to reach the good exit from the game.

🎯 HOW TO PLAY

The player’s goal is to collect all collectibles present on the map then escape with minimal movement. The main player is the similar logo to the school of 42, who must eat "camperos" (typical hamburgers from Málaga) and reach the blackhole, in a forest style map.

KEYBOARD ACTION
W, Move up
S, Move down
A, Move left
D, Move right
ESC ⎋ Key "Q"

Reference