Cub3d is a 42 project, written in C, which consisted in recoding a game using raycasting.
A config file is provided at the execution, example with parsing.cub
The graphic library used is the minilibx
R 1280 720
SO ./textures/jungle-1.xpm
NO ./textures/jungle-2.xpm
EA ./textures/jungle-3.xpm
WE ./textures/jungle-4.xpm
S ./textures/banana.xpm
C 31,14,28
F 100, 125, 52
11111
12001
100N1
11111
R
is the resolution of the screenSO
,NO
,EA
,WE
andS
are the xpm file used to represent the wall of the respectives directions:South, North, East, West
(the 1 on the map) and theSprite
(the 2 on the map)C
andF
are respectivelyCeiling
andFloor
, representing an RGB color.- The map that follows the rules: 1 for wall, 0 for the ceiling, 2 for the sprite, N, E, W or S for the spawn and its direction.
The goal of this project using the minilibx, was to be able to code a FPS 3D game, using raycasting. Parsing the config file to get all the textures, the map, the RGB colors. The map follows some rules such as:
- The map must be surrounded by walls
- There must be one and only one spawn
The creation of a bitmap file representing the screenshot of the first image of the game, without launching it, if the argument --save
is given.
Handle movement and collision with walls, handle hooks for keyboard keys:
- ZQSD to move (azerty)
- Arrow left and right for the camera view
- Escape to leave the game
First, run make
Then run:
You can edit parsing.cub
before to change the configuration of the game as explained above.
./Cub3D parsing.cub
Controls are ZQSD (azerty), Arrow Left/Right 🎮
If you want to create a screenshot of the game without launching it, you can use --save
as:
./Cub3D parsing.cub --save
Enjoy the game!