With my raycasting engines in construct i make it easy for me.
You will need:
player ------type: sprite
ray_angle ---type: sprite
2d_wall -----type: sprite
3d_wall -----type: sprite
2d_sprite ---type: sprite
3d_sprite ---type: sprite
Start of layout: for 0-119 create ray_angle at player.x+120 player.y-60+loopindex
Then, you either pin those points to the player via the behaviour or use the new hierarchy system.
Then you cast to those sprites and for the height of the "3D" walls you do:
for each ray_angle raycast....
To set the height of the "3d_wall" sprite you do:
120/player.lineofsight.hitdistance/cos(anglediff(player.angle,angle(player.x,player.y,player.lineofsight.hitx,player.lineofsight.hity)))*"something(the size of the 2d walls perhaps)?"
//Remember to put the origin on the left most side of the "3d_wall" sprite, and in the middle. Just press "4" on the keypad.
For the 2d sprite you will need 4 variables.
Cx = player.x - 2d_sprite.x
Cy = player.y - 2d_sprite.y
Sprite_angle = angle(0,0,2d_sprite.cx,2d_sprite.cy)-player.angle
X_pos = 60+tan(sprite_angle)*120 ///Half the screen width, times the full screen width.
3d_sprite: Set x position to 2d_sprite.x_pos
The y value you can set on creation or start of layout. 3d_sprite.y = (half the screen height). You can play around with the y value to see if you get any other game ideas...
3d_sprite height = 120/distance(player.x,player.y,2d_sprite.x,2d_sprite.y)/cos(anglediff(player.angle,angle(player.x,player.y,2d_sprite.x,2d_sprite.y)))*something, (probably same as the height for the "3d" walls)
If 3d_sprite height is lower than 0, set to 0.
3d_sprite width = 3d_sprite height. //You can play around with the width, depending on how you draw the billboard sprites.
Have a good one!