import pygame.draw
import pygame.locals as pgl
import pygame.rect
+import pygame.transform
from .constants import LIGHT_CATEGORY, FITTINGS_CATEGORY, COLOURS
from .rays import RayPolyManager
else:
self.colour = self.colour_cycle[self.colour_pos]
self.on = True
- self.invalidate_fitting_image()
def tick(self):
pass
self.angular_velocity = kw.pop("angular_velocity", None)
super(SpotLight, self).__init__(**kw)
+ def fitting_image(self):
+ fitting_image = super(SpotLight, self).fitting_image()
+ rot_fitting_image = pygame.transform.rotozoom(fitting_image, self.ray_manager.direction - 90, 1)
+
+ rot_rect = fitting_image.get_rect().copy()
+ rot_rect.center = rot_fitting_image.get_rect().center
+ rot_fitting_image = rot_fitting_image.subsurface(rot_rect).copy()
+
+ return rot_fitting_image
+
+
def tick(self):
if self.angular_velocity:
self.ray_manager.direction -= self.angular_velocity