Skip to content

Latest commit

ย 

History

History
74 lines (47 loc) ยท 1.76 KB

File metadata and controls

74 lines (47 loc) ยท 1.76 KB

so_long

๐ŸŽฎ Description

so_long is a 42 school project that consists of creating a small 2D game using MiniLibX, a simple graphical library provided by the school.

The goal is to practice file parsing, graphical rendering, data validation, and game logic while respecting strict programming constraints.


๐Ÿงฉ Objectives

  • Read and parse a map file in .ber format.
  • Render the map dynamically using 2D sprites.
  • Allow the player to move with keyboard inputs.
  • Manage interactions (collecting items, reaching the exit).
  • Count and display the number of movements.
  • Exit the game properly when the player wins or closes the window.

๐Ÿš€ Features

โœ… Game Engine

  • 2D map rendering with walls, floor, collectibles, exit, and player.
  • Player movement using W/Z, A/Q, S, D (or arrow keys).
  • Movement count displayed in the terminal.
  • Clean exit when closing the window or pressing ESC.

๐Ÿง  Parsing & Validation

  • Reads and validates the game map :
    • Must be rectangular.
    • Surrounded by walls.
    • Must contain at least one exit, one player, and one collectible.
    • Map must be solvable (validated with a pathfinding algorithm).

๐ŸŽจ Graphics

  • Uses MiniLibX for graphical rendering.
  • Custom sprites for each type of map element.

๐Ÿ“ Map Format

The map file must have a .ber extension and follow this structure :

  • 1 : Wall
  • 0 : Floor
  • P : Player start
  • C : Collectible
  • E : Exit

Bonus with :

  • X : Exit

๐Ÿ› ๏ธ Compilation

make
./so_long map/map0X.ber

Screenshot from 2025-04-21 15-12-21


A special thanks to Axiaaa for her help. ๐Ÿ™