temporarily adjust tony shirt glow effect

This commit is contained in:
ohsqueezy 2022-11-02 23:34:57 -04:00
parent d95b31a19b
commit 2369def547
1 changed files with 21 additions and 16 deletions

37
NS.py
View File

@ -787,10 +787,13 @@ class Tony(Sprite):
# Create a glowing effect object by adding glow frames to a blank Sprite. It can then be applied to the main Tony Sprite frame
# using `pygame.BLEND_RGBA_SUB`. Skip this if fast load is requested.
if not self.get_configuration("system", "minimize-load-time"):
self.effect = Sprite(self)
# self.effect = Sprite(self)
self.effect = Sprite(self, 120)
for offset in range(12):
w, h = dsr.w + 40, int(dsr.h * .65)
glow = Surface((w, h), SRCALPHA)
# w, h = dsr.w - 40, int(dsr.h * .65)
w, h = dsr.w - 120, int(dsr.h * .65)
# glow = Surface((w, h), SRCALPHA)
glow = Surface((w, h))
for ii, y in enumerate(range(h, 0, -8)):
hue = range(240, 200, -2)[(ii - offset) % 12]
alpha = min(100, int(round(y / float(h - 10) * 100)))
@ -800,7 +803,8 @@ class Tony(Sprite):
ellipse(glow, w // 2, y, w // 2 - 4, h // 20, color)
filled_ellipse(glow, w // 2, y, w // 2 - 4, h // 20, color)
self.effect.add_frame(glow)
self.effect.location.topleft = -20, int(dsr.h * .35)
# self.effect.location.topleft = -20, int(dsr.h * .35)
self.effect.location.midbottom = dsr.midbottom
self.add_frame(load(self.get_resource("Big_Tony.png")).convert_alpha())
self.load_from_path(self.get_resource("newTony/TonyShirtHead"), True)
@ -837,23 +841,24 @@ class Tony(Sprite):
effects are off. Update title screen objects. Update the board sub-animation if it is active.
"""
# Create an intermediate surface for blending the glow with the sprite frame
if self.get_configuration("display", "effects"):
save = self.get_display_surface()
intermediate_surface = Surface(self.location.size, SRCALPHA)
self.display_surface = intermediate_surface
location_save = self.location.copy()
self.location.topleft = 0, 0
# if self.get_configuration("display", "effects"):
# save = self.get_display_surface()
# intermediate_surface = Surface(self.location.size, SRCALPHA)
# self.display_surface = intermediate_surface
# location_save = self.location.copy()
# self.location.topleft = 0, 0
# Do a regular Sprite animation update
Sprite.update(self)
self.effect.update(flags=BLEND_RGBA_SUB)
# Blend the effect frame with the sprite frame
if self.get_configuration("display", "effects"):
self.display_surface = save
self.location = location_save
self.effect.display_surface = intermediate_surface
self.effect.update(flags=BLEND_RGBA_SUB)
self.get_display_surface().blit(intermediate_surface, self.location.topleft)
# if self.get_configuration("display", "effects"):
# self.display_surface = save
# self.location = location_save
# self.effect.display_surface = intermediate_surface
# self.effect.update(flags=BLEND_RGBA_SUB)
# self.get_display_surface().blit(intermediate_surface, self.location.topleft)
# Update title screen objects that are drawn over this sprite
if self.get_game().title.active: