This is just a demonstration of how raycasting works. If you want to see a real 3D project, go here: https://scratch.mit.edu/projects/1118366207/
Raycasting works just like it is called. Rays are cast out in your player's direction, and stop after hitting a wall. The code detects that blockage to map out where your walls are.