From a5a47d1c417c04dfe0809e97cd01dc0d9df7014b Mon Sep 17 00:00:00 2001 From: Frank DeMarco Date: Mon, 9 Jul 2018 22:38:07 -0400 Subject: [PATCH] fat --- NS.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/NS.py b/NS.py index e136f72..0a22c93 100644 --- a/NS.py +++ b/NS.py @@ -16,7 +16,8 @@ from pygame.image import load, fromstring from pygame.transform import rotate, flip from pygame.time import get_ticks from pygame.font import Font -from pygame.gfxdraw import aapolygon, arc +from pygame.draw import aalines, lines +from pygame.gfxdraw import aapolygon, arc, polygon from pygame.locals import * from lib.pgfw.pgfw.Game import Game @@ -791,7 +792,8 @@ class Platform(GameChild): if self.active: for light in self.lights: light.update() - + for light in self.lights: + light.draw_glow() class Light(Animation): @@ -854,21 +856,34 @@ class Light(Animation): elif self.is_playing(self.glow) and (not boss.queue or not self.in_orientation(boss.queue[chemtrails.queue_index])): self.reset() - points = self.points - else: + if not self.hidden: + ds = self.get_display_surface() + aa_filled_polygon(ds, self.get_points(), self.color) + + def get_points(self): + if self.get_game().introduction.active: points = [] for point in self.points: points.append((point[0], point[1] - self.INTRODUCTION_OFFSET)) - if not self.hidden: + return points + else: + return self.points + + def draw_glow(self): + for ii in reversed(xrange(0, self.glow_index, 1)): + shifted = [] + for point in self.get_points(): + shifted.append((point[0], point[1] - ii)) + ratio = 1 - float(ii + 1) / (self.MAX_GLOW_INDEX + 1) + alpha = int(ratio * 255) + color = Color(self.color.r, self.color.g, self.color.b, alpha) ds = self.get_display_surface() - aa_filled_polygon(ds, points, self.color) - for ii in reversed(xrange(self.glow_index)): - shifted = [] - for point in points: - shifted.append((point[0], point[1] - 1 * (ii + 1))) - alpha = (1 - float(ii + 1) / (self.MAX_GLOW_INDEX + 1)) * 255 - color = Color(self.color.r, self.color.g, self.color.b, int(alpha)) - aapolygon(ds, shifted, color) + intermediate = Surface(ds.get_size(), SRCALPHA) + lines(intermediate, + get_hsla_color(int(color.hsla[0]), int(color.hsla[1]), int(color.hsla[2]), int(ratio * 100)), + True, shifted, 5) + ds.blit(intermediate, (0, 0)) + # aapolygon(ds, shifted, color) def in_orientation(self, orientation): if self.position == NS.LNW: