Giter Club home page Giter Club logo

42bangkok-so_long's Introduction

42Bangkok so_long

norminette Creating a 2D graphic game with MinilibX.

so_long-cover


Installation

Clone this repository to your computer:

git clone https://github.com/viruskizz/42bangkok-so_long.git

First compile and install library

make

How to play

Rule

Control your character to collect all items in the map. Collect all items in map before exit. Avoid the enemy nonetheless you would died.

Command

Run game by execute so_long file.

./so_long

Run game with specific map file by add file name as argument

./so_long "simple.ber"

Recompile a game, After edit game.h setting

make restart

Key control

You can control the main character with specific key below. Sometime you need to hide yourself from an enemy. You need press spacebar to collect an item from ground.

Key Description
A or ⬅️ Walk Left
W or ⬆️ Walk Up
S or ⬇️ Walk Down
D or ➡️ Walk Right
CTRL or Control Hide
Spacebar Sit or Get an item
Enter Action to Exit Door

Logo

Watch full demo

Customize

Game Settings

You also can customize this game as you like. Just edit includes/game.h file. the game setting has describe below

Name Type description
FRAME_RATE *number time of rendering frame per second
BUF_SIZE *number buffer size of reader
SCORE_LEN *number length of score
TILE_SIZE number size of game 64 or 32 bit
ENEMY number Maximun enemy in map
SPAWN_RATE number spawn enemy rate per second
MAP_FILE string map file name in maps directory
*NOT RECOMMENDED TO CHANGE THIS VALUE

The default setting as below

# define GAME_H
# define FRAME_RATE     60
# define BUF_SIZE       4098
# define SCORE_LEN      4
# define TILE_SIZE      64
# define ENEMY          0
# define SPAWN_RATE     3
# define MAP_FILE       "simple_mon.ber"

Map File

You can create your own map file as you like but need to follow these rules.

  • map is covered with walls
  • map is contained with 1 item, 1 player and 1 exit door.
  • The map must be rectangular
  • map file name need end with .ber
  • place map file in maps directory

The character is defined in file follow like these

Character Description
0 Free space
1 Wall
P Player
E Exit door
C Collectable item
M Monster enemy

Map file example

1111111111111
10M100010CM01
10010100M00C1
100C011111001
1P0011E000001
1111111111111

Resources

Thank you

~~ Good luck with your projects! ~~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.