diff --git a/game.py b/game.py index 683775a..b6aec3b 100644 --- a/game.py +++ b/game.py @@ -50,13 +50,10 @@ class Game: self.player.speed = 150 self.player.update(walls=self.walls, dt=self.dt) + self.create_light_points() - def render(self) -> None: - self.display.fill((0, 0, 0, 0)) - - """RAYCASTING""" - ray_end = pygame.Vector2() + def create_light_points(self): self.light_points = [] vector = pygame.Vector2(LIGHT_RADIUS, 0) @@ -73,6 +70,11 @@ class Game: ray_end = schnittpunkt self.light_points.append(ray_end) + + def render(self) -> None: + + self.display.fill((0, 0, 0, 0)) + self.flashlight_rect = pygame.draw.polygon(self.display, (243, 255, 74), self.light_points) pygame.draw.rect(self.display, (255, 0, 0), self.flashlight_rect, 1) self.player.render(surface=self.display)