← Back to projects

so_long

Small 2D game in C built on MiniLibX: sprite rendering, map parsing and keyboard events.

Period
18/10/2022
Category
42
Area
Systems
Grade
100
Stack
  • C
  • MiniLibX
Links

A small 2D game in C, built on MiniLibX — one of the first graphics projects of the cursus.

The game

The player collects every collectible on the map, then leaves through the exit, which only opens once nothing is left to pick up. W A S D to move, ESC to quit.

The map

The program takes a .ber description file: a rectangular map, walled all around, written with five characters — 0 empty space, 1 wall, C collectible, E exit, P starting position. It must hold exactly one player and one exit, at least one collectible, and a path that lets the player reach the exit after collecting everything. Anything else is rejected before the window ever opens.

What it taught me

An event loop: opening a window, pushing images into it, handling keyboard events, and freeing every texture on the way out.