Skip to content

LuizGandra/so-long-42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

So Long - A 2D Arcade Game

So Long is a project from the 42 São Paulo Common Core curriculum. It involves creating a 2D game using the MiniLibX library, where a player navigates a map to collect items and reach an exit.

bonus

My implementation draws inspiration from the classic Pac-Man arcade game. Sprites were sourced from The Spriters Resource and adapted using Aseprite, a paid pixel art software, to adapt animations and fit the game design.

42 São Paulo

About 42

42 São Paulo is a tuition-free, global coding school focused on peer-to-peer learning and project-based education. This project introduces graphics programming and game development in C.

Project Overview

So Long implements a simple 2D game. The player moves through a map, collecting all items before exiting. It’s divided into:

  • Mandatory Part: A basic game with player movement, movement counting, item collection, and exit functionality, using a rectangular map with walls, a player, collectibles, and an exit.
  • Bonus Part: An enhanced version with additional features such as enemies, animations and movement count directly on the game screen.

mandatory

Key Features

  • Player navigates the map using the arrow keys or W, A, S and D, collecting items to unlock the exit.
  • Validates map integrity: rectangular shape, surrounded by walls, contains one player, one exit, and at least one collectible.
  • Displays move count in the shell upon each movement.
  • Uses MiniLibX for rendering graphics and handling events.
  • Bonus:
    • Displays the player's move count directly in the game window.
    • Adds immobile enemies to the game (as a personal extra, I added a variety of enemies based on the original Pac-Man).
    • Adds animations to the player and enemies..

Restrictions

  • Written in C, compliant with the 42 Norm.
  • No unexpected crashes (e.g., segmentation faults).
  • No memory leaks from heap allocations.
  • Compiled with -Wall -Wextra -Werror.
  • Requires valid .ber map files; invalid maps trigger an error message.

Getting Started

Prerequisites

  • C compiler (e.g., clang).
  • make utility.
  • libft library in libs/libft.
  • MiniLibX library in libs/mlx (Linux version).
  • X11 development libraries (libxext-dev, libx11-dev).

How to Build and Run

  1. Clone the repository:

    git clone https://github.com/LuizGandra/so-long-42.git
    cd so-long-42
    
  2. Build the mandatory part:

    make
    
  3. Run the game with a .ber map file:

    ./so_long maps/<map_name>.ber
    
  4. Build the bonus part (optional):

    make bonus
    
  5. Run the bonus game:

    ./so_long_bonus maps/valid_map_bonus.ber
    

Additional commands

  • make clean: remove object files.
  • make fclean: remove the program and object files.
  • make re: rebuild everything.

Project Structure

  • includes/so_long.h: header for mandatory part.
  • src/*.c: source files for so_long (e.g., main.c, map.c, render.c).
  • maps/*.ber: pre-made map files for testing.
  • bonus/includes/so_long_bonus.h: header for bonus part.
  • bonus/src/*.c: source files for so_long_bonus (e.g., main_bonus.c, animations_bonus.c).
  • Makefile: compilation automation.
  • libs/libft/: directory for the libft library.
  • libs/mlx/: directory for MiniLibX.

License

This project is part of the 42 curriculum and intended for educational use.

About

So Long is a 2D game project from the 42 São Paulo Common Core curriculum. Built with MiniLibX, it features a Pac-Man-inspired adventure with item collection and exit goals, enhanced in the bonus with enemies and Full HD map validation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors