Skip to content

a-chakkaf/so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 🧱 so_long

A simple 2D graphical game built using the **MiniLibX** graphics library. The player navigates through a map, collects items, and finds the exit. Part of the 42 Network's Common Core curriculum.

🕹️ Game Objective

  • Control the player (P) on a grid-based map.
  • Collect all the collectibles (C).
  • Reach the exit (E) after collecting all items.
  • Avoid stepping into invalid tiles (walls 1).

🛠️ Compilation

make        # Compile mandatory version
make bonus  # Compile bonus version (if implemented)
make clean  # Remove object files
make fclean # Remove object files and binaries

🗺️ Map Format

  • File extension: .ber

  • Valid characters:

    • 1 → Wall
    • 0 → Empty space
    • P → Player start (only one)
    • E → Exit (only one)
    • C → Collectible (at least one)

Example:

11111
1P0C1
100E1
11111

🎮 Controls

  • W / A / S / D → Move player
  • ESC → Quit the game

✅ Mandatory Requirements

  • Map must be rectangular and enclosed by walls.
  • Exactly 1 player, 1 exit, at least 1 collectible.
  • All collectibles must be collected before exiting.
  • The program must handle invalid maps gracefully.

🌟 Bonus Features (if implemented)

  • Enemy support (N)
  • Animations
  • Move counter display
  • Mouse/keyboard enhancements
  • Better UI visuals

💡 How It Works

  • The map is read from a .ber file and checked for validity.
  • A flood-fill algorithm ensures the map is solvable.
  • The game uses MiniLibX to render the map and handle events.

🧠 What I Learned

  • Graphics programming using MiniLibX
  • Handling user input
  • Validating and parsing files
  • Pathfinding algorithms (like flood-fill)
  • Clean code organization and Makefiles

📸 Screenshots

Alt text Alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published