Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐬 so_long — A 2D Adventure with Bats, Teleporters & Multi-Level Progression

"And thanks for all the fish!"

A top-down 2D puzzle game built with MiniLibX as part of the 42 School curriculum. Guide your character through increasingly complex maps, collect all coins, avoid deadly bats, and escape before it’s too late!


🎮 Features

so_long with spiralling.ber

Mandatory

  • Move with WASD or arrow keys
  • Collect all C (coins) before reaching the exit E
  • Walls 1 are impassable
  • Movement counter displayed in terminal

🌟 Bonus Features

  • On-screen movement counter (no need to check terminal!)
  • Animated bat enemies that:
    • Fly freely across the map
    • Randomly change direction
    • Kill the player on contact
  • Bidirectional teleportation:
    • Step on any T tile to instantly warp to another T tile
    • Teleporters are consumed on landing, not departure
    • Supports 2+ warp points — warp from 1→2, then 3→1, etc.
  • Game over screen with black background and red text
  • Win screen with green centered message

🎯 Multi-Level Mode (multi-level-play branch)

  • Start the game with: ./so_long
  • Play through 9 progressively harder levels
  • Automatic level progression upon victory
  • Final victory screen after completing all levels (I could not manage to see that one.. )
  • Replay from any level without passing previous levels, from level 0 -> 8
    fe : ./so_long 6 starts at level 7 ending at level 9 (8)

📁 Map Format (.ber)

Maps use these characters:

  • 1 — Wall (impassable)
  • F — false Wall (Player cleans tile by passing.., bats can fly over and reveal secret passage)
  • 0 — Empty space
  • P — Player start position
  • C — Collectible coin
  • E — Exit (must collect all coins first)
  • B — Bat spawn point (bonus)
  • T — Warp (Teleporter) tile (bidirectional, random destination between available warp points - be aware of bat presence at possible destinations!!!)

Example:

11111111
1P0T00C1
10B00001
100000E1
11111111

🛠️ Compilation

Standard (Mandatory + Bonus)

make
./so_long maps/map_of_your_choosing.ber

Multi-Level Mode

git checkout multi-level-play
make
./so_long  # No map argument needed — plays all 9 levels automatically

Bonus Rule (as required by subject)

make bonus && ./so_long

🎮 Controls

Key Action
W / ↑ Move up
A / ← Move left
S / ↓ Move down
D / → Move right
ESC Quit game
Window Close (X) Quit game

📜 Subject Compliance

  • Norminette compliant (25 lines max per function, no forbidden functions)
  • No memory leaks (Valgrind clean)
  • All heap memory properly freed
  • No undefined behavior or crashes
  • Bonus features in separate files (bonus.c, bonus_bis.c, etc.)
  • Uses only allowed functions: MiniLibX, libft, ft_printf, standard C

🧪 Testing

Tested on Ubuntu 22.04 with MiniLibX Linux version from 42 School repository.


🎨 Assets

  • Custom 32x32 pixel art for player, enemies, and teleporters
  • Smooth 5-frame bat animation
  • Clean, readable UI with on-screen counter

🚀 Enjoy the Game!

Dodge bats, warp through dimensions, and conquer all 9 levels!
Good luck — and watch out for those bats! 🦇

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages