Giter VIP home page Giter VIP logo

so_long's Introduction

so_long

so_long is a project developed for 42 Heilbroon School.

Keywords

C programming - data structure - videogames - MLX42 library

Short video example of the game

Subject

In this project I had to create a simple top-down view videogame, using C as programming language, and the MLX42 Codam library. For more info about the requirements, take a look at the subject contained in this repo.

Brief explanation

The project covers the following topics:

1. Input validation

As the project subject specifies, the input has to be correctly validated. The validation part includes: map file format, map sourrounded by walls, the presence of one Player and one Exit without duplicates, the presence of at least one Collectible, a rectangular map, a valid path to make the game playable.

2. Collecting data

During the validation process, the data is collected and stored into a so called t_data structure. A map as char ** is created as a base of data on which the graphical part is built. Other data is collected and stored, based on the requirements of the project.

3. Use of the graphical library

It is mandatory the use of MLX42 library, which handles the window and the images. For a deeper knowledge, I suggest to give a read to the official documentation of MLX42

4. Leaks free

Like in any other project of 42, the memory allocated by malloc() has to be properly freed. No leaks are tolerated. In this project I checked the leaks using a project of a school mate, which re-implements the malloc() function and traces the allocated memory. Take a look at the amazing project of iwillenshofer.

Bonus

The bonus part of the project is about add some simple animations to the sprites, make the player lose in case of touching an enemy and display the steps done directly on the screen instead of output them on the terminal.


Try it out

  1. Clone the repository:
git clone [email protected]:NicoCastelnuovo/so_long.git so_long
  1. Navigate to the so_long directory and make program, or make bonus for more funcionalities:
cd so_long
make bonus

According to the Makefile, this should compile the program, using the local version of the library. To get an idea about the dependencies of the library, I suggest again to read the MLX42 documentation. *

  1. Execute it, passing a valid map as argument:
./so_long maps/valid/map_3.ber
  1. Move the player using W A S D, and terminate the program using Esc.

  2. Save the poor Pizza Boy from the disgusting Ananas!

Note: The program has been built on MacOs so, even the MLX42 library works also on Linux and Windows, it's not guaranteed the same behavior on the other platforms.

Common error during make

Some dependencies are not installed or matched. In order to compile, MLX42 needs cmake and glfw. The problem could be either that they are not installed, or they are not in the correct path specified in the Makefile rules. For a more detailed explaination, visit the MLX42 repo and follow the instructions.

so_long's People

Stargazers

 avatar

Watchers

Nicolò Castelnuovo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.