so_long è uno dei primi progetti della Scuola 42 dedicati alla grafica. Lo scopo è creare un semplice videogioco 2D utilizzando la libreria grafica MiniLibX, fornita dalla scuola. Il progetto serve per imparare a gestire input da tastiera, disegnare elementi grafici su schermo, e lavorare con strutture dati per la gestione di mappe e movimenti in tempo reale.
Creare un gioco in cui un giocatore può muoversi all'interno di una mappa 2D, collezionare oggetti e raggiungere un'uscita, rispettando una serie di vincoli logici e tecnici.
-
La mappa è letta da un file
.bere rappresentata in formato testuale. -
Deve essere rettangolare, circondata da muri, e contenere almeno:
- un punto di partenza (
P) - una o più collezionabili (
C) - un'uscita (
E)
- un punto di partenza (
-
Il giocatore può muoversi con i tasti W, A, S, D.
-
Il gioco termina quando:
- il giocatore ha raccolto tutti gli oggetti
- raggiunge l’uscita
-
Ogni mossa deve essere stampata in console (es. "Moves: 4")
- Linguaggio: C
- Libreria grafica: MiniLibX (MLX)
- Nessun uso di librerie esterne o game engine
- Gestione degli errori obbligatoria (mappa non valida, file mancante, ecc.)
- Uso corretto della gestione della memoria (no leaks)
make downloadmake./so_long maps/<example>.bercambia con una mappa esistente in ./mapsmake fclean
so_long is one of the first projects at 42 School dedicated to graphics. The goal is to create a simple 2D video game using the MiniLibX graphics library provided by the school. The project helps students learn how to handle keyboard input, draw graphical elements on the screen, and work with data structures to manage maps and real-time movement.
Create a game where a player can move around a 2D map, collect items, and reach an exit, all while following a series of logical and technical constraints.
-
The map is read from a
.berfile and represented in textual format. -
It must be rectangular, surrounded by walls, and contain at least:
- one starting point (
P) - one or more collectibles (
C) - one exit (
E)
- one starting point (
-
The player can move using the W, A, S, D keys.
-
The game ends when:
- the player has collected all items
- the player reaches the exit
-
Each move must be printed to the console (e.g., "Moves: 4")
- Language: C
- Graphics library: MiniLibX (MLX)
- No use of external libraries or game engines
- Mandatory error handling (invalid map, missing file, etc.)
- Proper memory management (no leaks)
make downloadmake./so_long maps/<example>.berchange with a map present in ./mapsmake fclean