Skip to content

Small 2D game with minilibx, inspired by Pacman. My Theme: Lord of the Rings

Notifications You must be signed in to change notification settings

aaron-22766/42_so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

so_long

And thanks for all the fish!

GitHub code size in bytes Code language count GitHub top language GitHub last commit


🗣 About

This project is a very small 2D game. Its purpose is to make you work with textures, sprites, and some other very basic gameplay elements.

Theme

In the shadowed cloak of night, the ominous Nazgûl, cloaked in darkness and dread, stealthily infiltrated the venerable realm of Rivendell. Their nefarious purpose unveiled itself as they ruthlessly seized the shards of Narsil, the shattered remains of a once-mighty blade, foretelling doom for the free realms. Swiftly, the sons of Elrond, Elladan and Elrohir, undeterred by fear, pursued the Ringwraiths through the eldritch veil of night. Amidst their flight, the Nazgûl, tormented by the relentless pursuit of the elven brethren, faltered. In the dense thickets of the Wilderland, the shards slipped from their ghastly grasp, lost to the shadows. Aragorn, the heir to the throne of Gondor, burdened with destiny, was summoned to retrieve the shards swiftly, for they held the key to the redemption of a kingdom. But in this perilous quest, he was forewarned – beware the Nazgûl, the shadows of Sauron's malevolence, ever watchful, ever haunting, in their relentless pursuit of the One Ring and the heir to the line of Isildur.

Help Strider gather all the shards of Narsil and bring them back to Rivendell, where they shall be reforged! Don't let the Ringwraiths catch you!

Play Demo

🛠 Usage

Requirements

The game is written in C language and thus needs the gcc compiler and some standard C libraries to run. MLX42 is used as the graphics engine, since it is easier to work with than MiniLibX. Since MLX is optimized for the OS, this game can only be played on macOS.

Instructions

Run the mandatory version:

make
./so_long maps/*.ber

Run the bonus version:

make bonus
./so_long_bonus maps/bonus/*.ber

Play

  • Move: WASD or ↑←↓→
  • Sprint (bonus only): LEFT SHIFT
  • Exit: ESCAPE

Maps

  • The map has to be constructed with 3 components: walls, collectibles, and free space.

  • The map can be composed of only these 5 characters:

    • 0 for an empty space
    • 1 for a wall
    • C for a collectible
    • E for a map exit
    • P for the player’s starting position

    Bonus difference:

    • E for an enemy
    • X for a map exit
  • The map must contain 1 exit, at least 1 collectible, and 1 starting position to be valid.

  • The map must be rectangular.

  • The map must be closed/surrounded by walls.

  • You have to check if there’s a valid path in the map.

  • If any misconfiguration of any kind is encountered in the file, the program must exit in a clean way, and return "Error\n" followed by an explicit error message of your choice.

Here is a simple valid map (mandatory):

1111111111111
10010000000C1
1000011111001
1P0011E000001
1111111111111

Bonus example:

111111111
1P00001E1
101111111
101C00001
101011111
1000000C1
111011111
1C00000X1
111111111

💬 Description

Feature Madatory Bonus
player movement tile by tile smoothly between tiles
player rotation only one way turns whenever you change direction
move & collect counters printed to the terminal displayed in-game with custom font
enemies none walk straight until they hit a wall, then choose a new direction randomly, if you walk into them you die
animations none win and death animations that are 3x3 tiles big
sprint no yes