This commit is contained in:
Frank DeMarco 2018-07-09 22:38:07 -04:00
parent 8f7be5556b
commit a5a47d1c41
1 changed files with 28 additions and 13 deletions

41
NS.py
View File

@ -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: