This project is a small 2D game with minilibx. I have learned about textures, sprites and tiles.
- Graphics
- Imperative programming
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
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.
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
The objective is collect all items avoiding the enemys.
If you bump into flames you going to get toasted
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.