The So Long project at 42 is a beginner-level game development project that helps students learn the basics of graphics programming and game mechanics using the MiniLibX library. Here's an overview of the project:
Compile the code using the provided Makefile. Run the executable, providing the path to a valid map file.
Example usage:
./so_long maps/map_1.ber
- Create a 2D game: Develop a simple 2D game where a player can navigate through a map, collect items, and reach an exit to win.
- Learn graphics programming: Gain experience using the MiniLibX library for rendering graphics and handling user input in C.
-
Map File:
- The game map is defined in a
.berfile, which is a plain text file containing characters that represent different elements of the game. - Characters used in the map:
1: Wall (impassable terrain)0: Empty space (passable terrain)P: Player's starting positionC: CollectiblesE: Exit
- The game map is defined in a
-
Game Elements:
- Player: Moves through the map, controlled by keyboard input.
- Collectibles: Items that the player must collect.
- Exit: The player must reach this after collecting all collectibles to win the game.
-
Graphics and Input Handling:
- Use MiniLibX to render the map and game elements.
- Handle keyboard input to move the player character.
- Display the Map: Render the game map on the screen.
- Player Movement: Allow the player to move up, down, left, and right.
- Collecting Items: Update the map and game state when the player collects items.
- Winning Condition: Check if the player has collected all items and reached the exit.
- Graphics Programming: Understand the basics of rendering graphics and handling user input using MiniLibX.
- Game Loop: Implement a simple game loop that updates the game state and renders the game continuously.
- File Parsing: Read and interpret a map file to generate the game world.