diff --git a/raycaster.py b/raycaster.py index ddd659a..7eb744e 100755 --- a/raycaster.py +++ b/raycaster.py @@ -137,7 +137,9 @@ class Main: # Cast 60 rays from -30° to +30° (60° viewing angle) for i in range(60): - rayAngle = playerAngle - (i - 30)*DEGREE_IN_RADIANTS + rayAngle = playerAngle + (i - 30)*DEGREE_IN_RADIANTS + if rayAngle < 0: + rayAngle = 2 * math.pi + rayAngle # Check horizontal lines dof = 0 # Depth of field @@ -224,7 +226,7 @@ class Main: shortestDist = horizDist # Draw rays in 2D view - sdl2.ext.draw.line(self.mapSurface, sdl2.ext.Color(0,0,255,255), (self.player_position["x"], self.player_position["y"], rayX, rayY)) + sdl2.ext.draw.line(self.mapSurface, sdl2.ext.Color(i*4,0,255,255), (self.player_position["x"], self.player_position["y"], rayX, rayY)) # ------ Draw 3D view ------