Coder Social home page Coder Social logo

solong_ecole42's Introduction

so_longm

So_long a 2D Game

Introduction

This project is a small 2D game with minilibx. I have learned about textures, sprites and tiles.

Skills that I have improved

  • Graphics
  • Imperative programming

The project

The program receives a map with .ber extension

Sample map
1111111111111111
1E00000A00000AC1
1010010100100001
1010010010101011
1P000A000CA0C001
1111111111111111

Caption

  • 0 for an empty space
  • 1 for a wall
  • C for a collectible
  • E for a map exit
  • P for the player's starting position
  • A for adversary

The game is rendered based on a map with these configuration with the help of Minilibx that provides tools that put tiles in the windows at CPU time.

Rules of the game

  • The player can only be moved by WASD
  • The player cannot move into walls
  • The game ends if all items were collected
  • There is a movement counter on the top left side of the screen
  • If the player touches an enemy he dies and the game ends

What are my thoughts about the project?

The biggest challange in this project is learn how to use the Minilibx. This is because, the concept of events and how to handle these events where quite new for me. I had already learned how to deal with callback functions on Libft but I had not truly applied the concepts before. I didn't have any difficult dealing with the base for the game because projects that came before this one, were enough to provide me a solid control about my library. Of course that I had to deal with a lot of coding in a small range of time and because of this I couldn't apply all my ideas for the game.

Follow these steps to run the project

This project only runs on Linux
Run sudo apt-get update && sudo apt-get install xorg libxext-dev zlib1g-dev libbsd-dev
Run make or make bonus
If you are using WSL2 you must have Xming installed and then:
  Click Multiple windows and go to the next page
  Click Start no client and go to the next page
  Make sure that the No Access Control box is ticked and go to the next page
  Click Save configuration and then Finish
  Run export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0
  Run xeyes and check if a window appears
Inside the maps folder there are maps that can be played
For instance, run ./so_long ./maps/pdf1.ber

How to play it?

The objective is collect all items avoiding the enemys.

If you bump into flames you going to get toasted

Dead

You can move using the keyboard

W => Move up
S => Move down
A => Move left
D => Move right

Once all items were collected a door will be open an you can head into it.

Alive

solong_ecole42's People

Contributors

adrianofaus avatar

Watchers

 avatar

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.