Skip to content

Project 42 | 2D game development using the MiniLibX graphical library | Level 2 - Common Core

License

Notifications You must be signed in to change notification settings

HaruSnak/So_Long

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

so_long

So_Long

The "so_long" project at 42 School is a programming project designed to familiarize students with creating small 2D games using the MinilibX graphics library.

Contributors Forks Stargazers Issues LinkedIn

πŸ“’ Index

About

The So_Long project is an introduction to 2D game development for students at 42. Using the Minilibx library, you will create a 2D game that includes:

4-way character movement (W, S, A, D)
A move counter
A map that must be a rectangle with a valid path
A variety of restrictions/conditions to complete the project

Here are some additional details about the project:

The game must be developed using the C programming language.
The game must use the Minilibx library for graphics and input handling.
The game must have a start and end point.
The player must be able to move around the map.
The player must be able to collect objects on the map.
The player must avoid obstacles on the map.
The game must have a win condition and a lose condition.

Approach

From the start, I wanted to move away from the original project and explore a different path. My ambition was to create a top-down hack'n slash game that promised a fluid and enjoyable gameplay loop for the user. However, the time constraints forced me to favor a more familiar approach, while still keeping the two key points mentioned above.

This is how this "remastered Mario" was born, taking up the iconic gameplay loop of this legendary game. You start on one of the game's maps, with the mission of collecting as many coins as possible. But be careful, you may not be alone on this treasure-filled path!

player

I opted for a 2D oblique view, offering a dynamic and immersive perspective. The graphic elements were recovered from the Kenney website (free assets) and then reworked in Photoshop to integrate perfectly with the Minilibx environment.

In order to enrich the gameplay and bring an additional challenge, I introduced high structures and enemies. The player will thus be able to jump to overcome obstacles or dodge hostile monsters.

monster

(The UI outlines (heart, coins, and step counter) are in black because my WSL has transparency issues with Minilibx, which will work correctly once on MacOS. I'm sorry again for this inconvenience, which bothers me slightly.)

game

Features

Breadth-First Search (BFS) algorithm: Used to determine if an exit is possible from the player's position on the map.

Jumping ability: The player can now jump and descend more quickly by pressing the down arrow while in the air.

Various animations: Added animations for monsters, coins, and the player.

Player HUD: Displays information such as health, coins collected, and move count.

Basic AI for monsters: Monsters follow a simple path and have a hitbox that can damage the player.

Features to be added:

Player-centered camera: To create a sense of progression in the game.

Improved hitboxes and asset clipping: To prevent collision issues and improve the overall look of the game.

Win and lose screens: To indicate the end of the game and provide feedback to the player.

Scaling assets to 100x100: To reduce the player's X-axis and provide a better sense of movement.

Installation

# Clone this repository
$ git clone https://github.com/HaruSnak/So_Long.git

# Go into the repository
$ cd So_Long

# To compile the program
$ make

# Execution example
$ ./so_long {NAME_MAP}.ber

# Allows you to do a complete cleaning of your construction environment
$ make fclean # Or make clean

Development

Pre-Requisites

Requirements for Linux

MinilibX only support TrueColor visual type (8,15,16,24 or 32 bits depth)
gcc
make
X11 include files (package xorg)
XShm extension must be present (package libxext-dev)
Utility functions from BSD systems - development files (package libbsd-dev)
e.g. sudo apt-get install gcc make xorg libxext-dev libbsd-dev (Debian/Ubuntu)

File Structure

.
└── πŸ“so_long
    └── Makefile
    └── πŸ“assets
        └── πŸ“heart
            └── heart.xpm
            └── heart_empty.xpm
        └── πŸ“monsters
            └── monster_b.xpm
            └── monster_w.xpm
        └── πŸ“player
            └── ply_base.xpm
            └── ply_base_dps.xpm
            └── ply_base_r.xpm
            └── ply_jump.xpm
            └── ply_jump_r.xpm
            └── ply_walk.xpm
            └── ply_walk1.xpm
            └── ply_walk1_r.xpm
            └── ply_walk2.xpm
            └── ply_walk2_r.xpm
            └── ply_walk3.xpm
        └── πŸ“tiles
            └── bg.xpm
            └── cloud_center.xpm
            └── cloud_left.xpm
            └── cloud_right.xpm
            └── coin.xpm
            └── coin_r.xpm
            └── exit.xpm
            └── flag.xpm
            └── grass.xpm
            └── grass_center.xpm
            └── grass_l_c.xpm
            └── grass_left.xpm
            └── grass_r_c.xpm
            └── grass_right.xpm
            └── other_1.xpm
            └── other_2.xpm
            └── other_3.xpm
            └── platform.xpm
            └── sign_right.xpm
            └── start.xpm
            └── wall.xpm
            └── water_down.xpm
            └── water_up.xpm
        └── πŸ“ui
            └── eight_coin.xpm
            └── five_coin.xpm
            └── four_coin.xpm
            └── main_menu.xpm
            └── nine_coin.xpm
            └── one_coin.xpm
            └── seven_coin.xpm
            └── six_coin.xpm
            └── ten_coin.xpm
            └── three_coin.xpm
            └── two_coin.xpm
            └── walk.xpm
    └── πŸ“includes
        └── πŸ“libft
            └── Makefile
            └── πŸ“char
                └── ft_isalnum.c
                └── ft_isalpha.c
                └── ft_isascii.c
                └── ft_isdigit.c
                └── ft_isprint.c
                └── ft_tolower.c
                └── ft_toupper.c
            └── πŸ“conv
                └── ft_atoi.c
                └── ft_itoa.c
            └── πŸ“gnl
                └── get_next_line.c
            └── πŸ“includes
                └── libft.h
            └── πŸ“lst
                └── ft_lstadd_back_bonus.c
                └── ft_lstadd_front_bonus.c
                └── ft_lstclear_bonus.c
                └── ft_lstdelone_bonus.c
                └── ft_lstiter_bonus.c
                └── ft_lstlast_bonus.c
                └── ft_lstmap_bonus.c
                └── ft_lstnew_bonus.c
                └── ft_lstsize_bonus.c
            └── πŸ“mem
                └── ft_bzero.c
                └── ft_calloc.c
                └── ft_memchr.c
                └── ft_memcmp.c
                └── ft_memcpy.c
                └── ft_memmove.c
                └── ft_memset.c
            └── πŸ“printf
                └── ft_conv_primary.c
                └── ft_conv_specifies.c
                └── ft_conv_suit.c
                └── ft_printf.c
            └── πŸ“put
                └── ft_putchar.c
                └── ft_putchar_fd.c
                └── ft_putendl_fd.c
                └── ft_putnbr.c
                └── ft_putnbr_fd.c
                └── ft_putstr.c
                └── ft_putstr_fd.c
            └── πŸ“str
                └── ft_split.c
                └── ft_strchr.c
                └── ft_strdup.c
                └── ft_striteri.c
                └── ft_strjoin.c
                └── ft_strlcat.c
                └── ft_strlcpy.c
                └── ft_strlen.c
                └── ft_strmapi.c
                └── ft_strncmp.c
                └── ft_strnstr.c
                └── ft_strrchr.c
                └── ft_strtrim.c
                └── ft_substr.c
        └── so_long.h
    └── πŸ“maps
        └── error1.ber
        └── error10.ber
        └── error11.ber
        └── error2.ber
        └── error3.ber
        └── error4.ber
        └── error5.ber
        └── error6.ber
        └── error7.ber
        └── error8.ber
        └── error9.ber
        └── map1.ber
        └── map2.ber
        └── map3.ber
        └── mini2.ber
        └── mini3.ber
    └── πŸ“minilibx-linux
    └── πŸ“srcs
        └── πŸ“bonus
            └── πŸ“monster
                └── monster.c
            └── πŸ“player_bonus
                └── player_coin.c
        └── πŸ“errors
            └── errors.c
        └── πŸ“game
            └── settings.c
        └── πŸ“map
            └── draw.c
            └── path_include.c
        └── πŸ“parsing
            └── parsing.c
            └── path_bfs.c
            └── path_valid.c
        └── πŸ“player
            └── player.c
            └── player_animation.c
            └── player_collision.c
            └── player_gravity.c
        └── so_long.c
        └── πŸ“ui
            └── hud.c
            └── main_menu.c

Diagram Architecture

Write the build Instruction here.

Notes

You can optionally add a FAQ section about the project.

Credits

Below you will find the links used for this project:

About

Project 42 | 2D game development using the MiniLibX graphical library | Level 2 - Common Core

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published