increase screen resolution to widescreen, adjust title screen and screen wipe graphics

This commit is contained in:
frank 2022-02-24 14:32:29 -05:00
parent 607f6a8059
commit ad2b75e8f1
3 changed files with 41 additions and 12 deletions

47
NS.py
View File

@ -472,6 +472,8 @@ class Tony(Sprite):
for sfx_name in self.get_audio().sfx: for sfx_name in self.get_audio().sfx:
if sfx_name.startswith("TonyTauntsBend_"): if sfx_name.startswith("TonyTauntsBend_"):
self.taunts.append(sfx_name) self.taunts.append(sfx_name)
self.location.centerx = dsr.centerx
self.board.location.centerx = self.location.centerx
def set_frameset(self, name): def set_frameset(self, name):
Sprite.set_frameset(self, name) Sprite.set_frameset(self, name)
@ -495,8 +497,11 @@ class Tony(Sprite):
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()
self.location.topleft = 0, 0
Sprite.update(self) Sprite.update(self)
self.display_surface = save self.display_surface = 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)
@ -739,7 +744,7 @@ class Dialogue(Animation):
Animation.__init__(self, parent) Animation.__init__(self, parent)
ds = self.get_display_surface() ds = self.get_display_surface()
dsr = ds.get_rect() dsr = ds.get_rect()
frame = Surface((640, 72)) frame = Surface((dsr.w, 72))
frame.fill(self.BORDER) frame.fill(self.BORDER)
frame.fill(self.BACKGROUND, (1, 1, frame.get_width() - 2, frame.get_height() - 2)) frame.fill(self.BACKGROUND, (1, 1, frame.get_width() - 2, frame.get_height() - 2))
self.text_box = Sprite(self) self.text_box = Sprite(self)
@ -946,18 +951,29 @@ class AdvancePrompt(GameChild):
class Wipe(Animation): class Wipe(Animation):
"""
This class creates a blinds screen wipe effect that can be given a callback function to be called exactly when the screen is
filled with the wipe graphic. This allows the game to transition between states behind the wipe graphic to create a curtain
effect.
"""
BLIND_COUNT = 4 BLIND_COUNT = 4
SPEED = 6 SPEED = 6
TRANSPARENT_COLOR = 255, 0, 0
def __init__(self, parent): def __init__(self, parent):
"""
Initialize the wipe image and sound effect
@param parent PGFW game object that instantiated the wipe
"""
Animation.__init__(self, parent) Animation.__init__(self, parent)
self.image = load(self.get_resource("Ink.png")).convert() self.image = load(self.get_resource("Ink.png")).convert()
self.image.set_colorkey(self.TRANSPARENT_COLOR)
self.sound = self.get_audio().sfx["wipe"] self.sound = self.get_audio().sfx["wipe"]
def reset(self): def reset(self):
"""
Deactivate and stop the animation
"""
self.deactivate() self.deactivate()
self.halt() self.halt()
@ -968,15 +984,24 @@ class Wipe(Animation):
self.active = True self.active = True
def start(self, callback): def start(self, callback):
"""
Trigger the wipe animation to begin. The given callback function will be called when the screen is filled with the
wipe graphic.
@param callback function to be called when the wipe is covering the screen
"""
self.activate() self.activate()
self.up = True self.up = True
# self.get_game().suppress_input()
self.blind_height = self.get_display_surface().get_height() / self.BLIND_COUNT self.blind_height = self.get_display_surface().get_height() / self.BLIND_COUNT
self.callback = callback self.callback = callback
self.play() self.play()
self.sound.play() self.sound.play()
def build_frame(self): def build_frame(self):
"""
This grows and shrinks the height of the blinds that control how much of the wipe graphic is currently displayed. It
will be called automatically every frame as long as the wipe's update method is being called.
"""
if self.up: if self.up:
self.blind_height -= self.SPEED self.blind_height -= self.SPEED
if self.blind_height <= 0: if self.blind_height <= 0:
@ -990,18 +1015,22 @@ class Wipe(Animation):
self.get_game().unsuppress_input() self.get_game().unsuppress_input()
def update(self): def update(self):
"""
Use the blind height value and screen clipping to draw the screen wipe in the state indicated by the blind height. The
screen is clipped to rects based on the blind height, and only those rects will have the wipe graphic drawn. Other screen
areas will show what is being drawn behind the screen wipe.
"""
if self.active: if self.active:
Animation.update(self) Animation.update(self)
ds = self.get_display_surface() ds = self.get_display_surface()
dsr = ds.get_rect() dsr = ds.get_rect()
frame = self.image.copy()
for y in range(0, dsr.h, dsr.h // self.BLIND_COUNT): for y in range(0, dsr.h, dsr.h // self.BLIND_COUNT):
if self.up: if self.up:
frame.fill(self.TRANSPARENT_COLOR, (0, y, dsr.w, self.blind_height)) ds.set_clip((0, y, dsr.w, dsr.h // self.BLIND_COUNT - self.blind_height))
else: else:
frame.fill(self.TRANSPARENT_COLOR, ds.set_clip((0, y + self.blind_height, dsr.w, dsr.h // self.BLIND_COUNT - self.blind_height))
(0, y + dsr.h / self.BLIND_COUNT - self.blind_height, dsr.w, self.blind_height)) ds.blit(self.image, (0, 0))
ds.blit(frame, (0, 0)) ds.set_clip(None)
class Platform(GameChild): class Platform(GameChild):

6
config
View File

@ -23,14 +23,14 @@ data-exclude = local/, *.pyc, .git*, README, build/, dist/, *.egg-info, *.py, MA
[display] [display]
caption = Scrapeboard caption = Scrapeboard
show-framerate = no show-framerate = no
dimensions = 640, 480 dimensions = 854, 480
fullscreen = no fullscreen = no
attract-gif-alpha = 0.95 attract-gif-alpha = 0.95
effects = yes effects = yes
[system] [system]
# will force set display->effects to off # will force set display->effects to off
minimize-load-time = no minimize-load-time = yes
[mouse] [mouse]
visible = no visible = no
@ -70,4 +70,4 @@ nw_color = #00FF88
ne_color = #FF88FF ne_color = #FF88FF
se_color = #2222FF se_color = #2222FF
sw_color = #FF2222 sw_color = #FF2222
center = 319, 376 center = 427, 376

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 52 KiB