hi,
if you are working on a classic raycasting engine like wolfenstein3d or
similar games used where you only have vertical walls there is a short
tutorial on http://www.permadi.com/tutorial/raycast/ or one at
http://student.kuleuven.be/~m0216922/CG/raycasting.html
they are both not in python or pygame but they explain how the textures
are calculated.
in the end you simply have to draw a scaled one pixel column of a
texture on every column of the screen. for this you can maybe use
pygame.transform.chop and pygame.transform.scale but it might be to slow.
if you want to do it yourself you can use a modified bresenham
algorithmus. http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
because you need only the y coordinates for vertical lines you can use
the x coordinate for the position in the texture you draw.
chrigi
Julia schrieb:
Hi everyone!
I am currently working on a raycasting engine using pygame for
graphics. The
engine works great and now I'm thinking about adding support for textures.
The problem is that I'm not really sure to with modules and methods to
use.
I need to be able to load textures, scale then to fit and then draw the
scaled image. Any tips on a smart way to do this? Good tutorial url's are
also appreciated :)
/ J