From: adrianna Date: Sat, 10 Sep 2016 11:25:06 +0000 (+0200) Subject: rotating spotlight fixture X-Git-Tag: tabakrolletjie-v1.0.0~118^2~1 X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=commitdiff_plain;h=8406c478924d4364b9a017f655e6757863341ff9 rotating spotlight fixture --- diff --git a/TODO.txt b/TODO.txt index e94fc8d..bfc582a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,7 +6,6 @@ TODO * Battery and light power consts * Mould resistances * Mould power increases to prevent farming -* Fitting rotation * Save game * More sounds * Five levels @@ -17,3 +16,4 @@ Done * Light colour selection * All lights multicolour * Light direction configuration +* Fitting rotation diff --git a/data/images/32/spotlight.png b/data/images/32/spotlight.png index 4e55c02..0cf4b79 100644 Binary files a/data/images/32/spotlight.png and b/data/images/32/spotlight.png differ diff --git a/data/images/48/spotlight.png b/data/images/48/spotlight.png index b7231c8..e4bdf3d 100644 Binary files a/data/images/48/spotlight.png and b/data/images/48/spotlight.png differ diff --git a/data/images/cursors/spotlight.png b/data/images/cursors/spotlight.png index 4e55c02..0cf4b79 100644 Binary files a/data/images/cursors/spotlight.png and b/data/images/cursors/spotlight.png differ diff --git a/sources/vector/spotlight.svg b/sources/vector/spotlight.svg index 4f0d58b..11c4300 100644 --- a/sources/vector/spotlight.svg +++ b/sources/vector/spotlight.svg @@ -26,8 +26,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.4" - inkscape:cx="123.25557" - inkscape:cy="182.29837" + inkscape:cx="115.01124" + inkscape:cy="139.81635" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -63,14 +63,14 @@ id="layer1" transform="translate(0,-698.0315)"> diff --git a/tabakrolletjie/lights.py b/tabakrolletjie/lights.py index fef2b44..7b2c263 100644 --- a/tabakrolletjie/lights.py +++ b/tabakrolletjie/lights.py @@ -9,6 +9,7 @@ import pygame.display 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 @@ -258,7 +259,6 @@ class BaseLight(object): else: self.colour = self.colour_cycle[self.colour_pos] self.on = True - self.invalidate_fitting_image() def tick(self): pass @@ -312,6 +312,17 @@ class SpotLight(BaseLight): 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