Anyone know how to display sprites in a raycasting engine? I am a bit stuck in figuring it out.
I have the distance of each column from the player How would i correctly position the sprite so it scales and looks correct in the world?
Anyone know how to display sprites in a raycasting engine? I am a bit stuck in figuring it out.
I have the distance of each column from the player How would i correctly position the sprite so it scales and looks correct in the world?
You must keep track of when you hit a cell that has a sprite in it. When you hit this cell, save the screen coords and distance. Then when you leave the cell, save the screen coords.
When you go through your buffer - start your sprite drawing at the saved screen coords and make the sprite spriteheight/distance pixels tall.