SCHOOL · PROJECT

so_long

2D game using MinilibX (MLX)

GitHub Repo
CMinilibXSprite RenderingMap ParsingEvent Loop

Overview

so_long is a small 2D game written in C using the MLX graphics library. It focuses on fundamentals: window creation, image/sprite loading, event handling, map parsing with flood-fill validation, and collision logic.

Highlights

  • Tile-based map with collectibles, exits, and enemies
  • Sprite rendering and basic animation
  • Flood-fill map validation to ensure solvability
  • Deterministic input/event loop with key handling

Technical Details

  • Maps are parsed from .ber files; invalid shapes and unreachable goals are rejected
  • Player movement is grid-aligned with collision checks
  • Textures are loaded via MLX; assets are composed into a single frame each tick
  • Memory management and resource cleanup are handled carefully to avoid leaks

Challenges

  • Designing a robust parser for variable-sized maps
  • Keeping rendering consistent across machines
  • Avoiding edge-case crashes during asset loading and teardown

What I Learned

  • Practical asset lifecycle management in C
  • Foundations of 2D rendering and timing
  • Testing strategies for I/O heavy code
so_long · Projects · Mohamed Kobaa