Skip to content

leite-tiago/so_long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ•น๏ธ so_long

so_long is a 2D game developed as part of the 42 curriculum. The project involves creating a simple graphical game using the MiniLibX library, where the player collects items and reaches the exit while navigating through a map. This repository includes the mandatory part of the project and can optionally include bonus features.


๐ŸŽฎ Gameplay

  • The player starts on the map and must collect all collectibles (C) before reaching the exit (E).
  • The player navigates using the arrow keys or W, A, S, D.
  • The game ends when the player reaches the exit after collecting all the collectibles.

๐Ÿ“‹ Features

Mandatory

  • Display the game map as a grid of sprites.
  • Handle player movement and ensure valid gameplay rules.
  • Close the game properly when:
    • The user presses the ESC key.
    • The user clicks the close button on the window frame.

Bonus Features

  • Display movement count directly on the screen.
  • Add animations for sprites.
  • Introduce enemy patrols that cause the player to lose upon collision.

๐Ÿš€ Getting Started

Prerequisites

  • macOS or Linux (MiniLibX is not natively supported on Windows).
  • MiniLibX installed.
  • X11 libraries (Linux) or XQuartz (macOS).

Installation

  1. Clone the repository:

    git clone https://github.com/leite-tiago/so_long.git
    cd so_long
  2. Compile the project:

    make
  3. Run the game:

    ./so_long <map_file>

๐Ÿ—บ๏ธ Map Requirements

  • The map must be rectangular.
  • It must contain:
    • At least one player starting position (P)
    • At least one exit (E)
    • At least one collectible (C)
  • Walls (1) must surround the entire map.
  • Other tiles should be empty space (0).

Example map:

111111
1P0C01
100001
1C0E01
111111

๐Ÿ“‚ File Structure

so_long/
โ”œโ”€โ”€ assets/               # Sprites for the game
โ”œโ”€โ”€ include/              # Header files
โ”œโ”€โ”€ src/                  # Source code
โ”‚   โ”œโ”€โ”€ main.c            # Entry point
โ”‚   โ”œโ”€โ”€ map.c             # Map parsing and validation
โ”‚   โ”œโ”€โ”€ game.c            # Core game logic
โ”‚   โ”œโ”€โ”€ render.c          # Rendering logic
โ”‚   โ”œโ”€โ”€ events.c          # Event handling
โ”œโ”€โ”€ Makefile              # Build instructions
โ””โ”€โ”€ README.md             # Project documentation

๐Ÿ› ๏ธ Built With

  • MiniLibX - Graphics library.
  • C programming language.

๐Ÿ“– Future Improvements

  • Enhanced animations for more immersive gameplay.
  • Complex enemy AI for challenging levels.
  • Dynamic map resizing during gameplay.

โœจ Acknowledgments

This project is part of the 42 Network curriculum. Special thanks to the 42 community for guidance and support!


๐Ÿ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

๐Ÿ•น๏ธ so_long โ€” This project is a very small 2D game. Its purpose is to learn how to work with textures, sprites, and some other very basic gameplay elements.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors