toggle-able tony shirt glow effect
This commit is contained in:
parent
2369def547
commit
e86a3d2324
43
NS.py
43
NS.py
|
@ -188,7 +188,7 @@ class NS(Game, Animation):
|
||||||
"display":
|
"display":
|
||||||
{
|
{
|
||||||
"float": "attract-gif-alpha",
|
"float": "attract-gif-alpha",
|
||||||
"bool": "effects"
|
"bool": ["effects", "alpha-effect-title"]
|
||||||
},
|
},
|
||||||
"system":
|
"system":
|
||||||
{
|
{
|
||||||
|
@ -787,12 +787,16 @@ 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
|
# 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.
|
# using `pygame.BLEND_RGBA_SUB`. Skip this if fast load is requested.
|
||||||
if not self.get_configuration("system", "minimize-load-time"):
|
if not self.get_configuration("system", "minimize-load-time"):
|
||||||
# self.effect = Sprite(self)
|
if self.get_configuration("display", "alpha-effect-title"):
|
||||||
|
self.effect = Sprite(self)
|
||||||
|
else:
|
||||||
self.effect = Sprite(self, 120)
|
self.effect = Sprite(self, 120)
|
||||||
for offset in range(12):
|
for offset in range(12):
|
||||||
# w, h = dsr.w - 40, int(dsr.h * .65)
|
if self.get_configuration("display", "alpha-effect-title"):
|
||||||
|
w, h = dsr.w - 40, int(dsr.h * .65)
|
||||||
|
glow = Surface((w, h), SRCALPHA)
|
||||||
|
else:
|
||||||
w, h = dsr.w - 120, int(dsr.h * .65)
|
w, h = dsr.w - 120, int(dsr.h * .65)
|
||||||
# glow = Surface((w, h), SRCALPHA)
|
|
||||||
glow = Surface((w, h))
|
glow = Surface((w, h))
|
||||||
for ii, y in enumerate(range(h, 0, -8)):
|
for ii, y in enumerate(range(h, 0, -8)):
|
||||||
hue = range(240, 200, -2)[(ii - offset) % 12]
|
hue = range(240, 200, -2)[(ii - offset) % 12]
|
||||||
|
@ -803,7 +807,9 @@ class Tony(Sprite):
|
||||||
ellipse(glow, w // 2, y, w // 2 - 4, h // 20, color)
|
ellipse(glow, w // 2, y, w // 2 - 4, h // 20, color)
|
||||||
filled_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.add_frame(glow)
|
||||||
# self.effect.location.topleft = -20, int(dsr.h * .35)
|
if self.get_configuration("display", "alpha-effect-title"):
|
||||||
|
self.effect.location.topleft = -20, int(dsr.h * .35)
|
||||||
|
else:
|
||||||
self.effect.location.midbottom = dsr.midbottom
|
self.effect.location.midbottom = dsr.midbottom
|
||||||
|
|
||||||
self.add_frame(load(self.get_resource("Big_Tony.png")).convert_alpha())
|
self.add_frame(load(self.get_resource("Big_Tony.png")).convert_alpha())
|
||||||
|
@ -841,24 +847,25 @@ class Tony(Sprite):
|
||||||
effects are off. Update title screen objects. Update the board sub-animation if it is active.
|
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
|
# Create an intermediate surface for blending the glow with the sprite frame
|
||||||
# if self.get_configuration("display", "effects"):
|
if self.get_configuration("display", "alpha-effect-title"):
|
||||||
# save = self.get_display_surface()
|
save = self.get_display_surface()
|
||||||
# intermediate_surface = Surface(self.location.size, SRCALPHA)
|
intermediate_surface = Surface(self.location.size, SRCALPHA)
|
||||||
# self.display_surface = intermediate_surface
|
self.display_surface = intermediate_surface
|
||||||
# location_save = self.location.copy()
|
location_save = self.location.copy()
|
||||||
# self.location.topleft = 0, 0
|
self.location.topleft = 0, 0
|
||||||
|
|
||||||
# Do a regular Sprite animation update
|
# Do a regular Sprite animation update
|
||||||
Sprite.update(self)
|
Sprite.update(self)
|
||||||
self.effect.update(flags=BLEND_RGBA_SUB)
|
|
||||||
|
|
||||||
# Blend the effect frame with the sprite frame
|
# Blend the effect frame with the sprite frame
|
||||||
# if self.get_configuration("display", "effects"):
|
if self.get_configuration("display", "alpha-effect-title"):
|
||||||
# self.display_surface = save
|
self.display_surface = save
|
||||||
# self.location = location_save
|
self.location = location_save
|
||||||
# self.effect.display_surface = intermediate_surface
|
self.effect.display_surface = intermediate_surface
|
||||||
# self.effect.update(flags=BLEND_RGBA_SUB)
|
self.effect.update(flags=BLEND_RGBA_SUB)
|
||||||
# self.get_display_surface().blit(intermediate_surface, self.location.topleft)
|
self.get_display_surface().blit(intermediate_surface, self.location.topleft)
|
||||||
|
else:
|
||||||
|
self.effect.update(flags=BLEND_RGBA_SUB)
|
||||||
|
|
||||||
# Update title screen objects that are drawn over this sprite
|
# Update title screen objects that are drawn over this sprite
|
||||||
if self.get_game().title.active:
|
if self.get_game().title.active:
|
||||||
|
|
Loading…
Reference in New Issue