Project 11: Cub3D - Eleventh project for the formation of software engineers at school 42 São Paulo.
- This project is inspired by the world-famous Wolfenstein 3D game. Our goal is to create a raycaster.
- Clone the repository
git clone git@github.com:Vinicius-Santoro/42-formation-lvl2-11.cub3d.git
- Run
make
to compile common part. - To clean objects files execute:
make clean
- To clean executable file and objects:
make fclean
- Recompile:
make re
- Run
./cub3D
or followed by map path e.g../assets/maps/map42.cub
To run the game, you must pass as first argument a scene description file with the .cub extension.
The file must have 6 element identifiers:
Identifier | Description |
---|---|
NO | Represents the texture of the wall in the north direction |
SO | Represents the wall texture in the south direction |
WE | Represents the wall texture in the west direction |
EA | Represents the wall texture in the east direction |
C | Represents the RGB color scale of the celling |
F | Represents the RGB color scale of the floor |
Example in a .cub file:
NO ./assets/Images/north.xpm
SO ./assets/Images/south.xpm
WE ./assets/Images/west.xpm
EA ./assets/Images/east.xpm
F 200,200,200
C 0,0,0
The map construction is composed by the following characters:
- Walls:
'1'
- Empty spaces inside:
'0'
- Empty spaces outside:
' '
- Initial player direction:
'N'
,'S'
,'W'
or'E'
- It must be completely surrounded by walls
- It must have a player
Map example:
1111111111111111111111111111111111111
1000000000000000000000000000000000001
1001111000001111000001111111111111001
1001111000001111000001111111111111001
1001111000001111000001111111111111001
1001111000001111000000000000001111001
1001111111111111000001111111111111001
1001111111111111000001111111111111001
1000000000001111000001111111111111001
1000000000001111000001111000000000001
1000000000001111000001111111111111001
1000000000001111000001111111111111001
100000000000000000N000000000000000001
1111111111111111111111111111111111111
- The
'→'
and'←'
keys of the keyboard allow you to look left and right in the maze. - The
'W'
,'A'
,'S'
and'D'
keys allow you to move the point of view through the maze. 'Esc'
key exits the game.