tony places board on platform
This commit is contained in:
parent
a06549f890
commit
1df3863638
135
NS.py
135
NS.py
|
@ -68,6 +68,8 @@ class NS(Game, Animation):
|
|||
self.background = Surface(ds.get_size())
|
||||
self.background.fill((0, 0, 0))
|
||||
self.platform = Platform(self)
|
||||
self.tony = Tony(self)
|
||||
self.logo = Logo(self)
|
||||
self.title = Title(self)
|
||||
self.introduction = Introduction(self)
|
||||
self.ending = Ending(self)
|
||||
|
@ -75,7 +77,6 @@ class NS(Game, Animation):
|
|||
self.dialogue = Dialogue(self)
|
||||
self.chemtrails = Chemtrails(self)
|
||||
self.boss = Boss(self)
|
||||
self.tony = Tony(self)
|
||||
if self.serial_enabled():
|
||||
self.serial_kill = False
|
||||
self.serial_data = 0
|
||||
|
@ -320,7 +321,10 @@ class Meter(GameChild):
|
|||
class Tony(Sprite):
|
||||
|
||||
def __init__(self, parent):
|
||||
Sprite.__init__(self, parent)
|
||||
Sprite.__init__(self, parent, 100, False)
|
||||
self.board = Sprite(self, 100)
|
||||
self.board.load_from_path(self.get_resource("newTony/TonyArms"), True)
|
||||
self.effect = Sprite(self)
|
||||
dsr = self.get_display_surface().get_rect()
|
||||
for offset in range(12):
|
||||
w, h = dsr.w + 40, int(dsr.h * .65)
|
||||
|
@ -333,9 +337,45 @@ class Tony(Sprite):
|
|||
aaellipse(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)
|
||||
frame = load(self.get_resource("Big_Tony.png")).convert_alpha()
|
||||
frame.blit(glow, (-20, int(dsr.h * .35)), None, BLEND_RGBA_SUB)
|
||||
self.add_frame(frame)
|
||||
self.effect.add_frame(glow)
|
||||
self.effect.location.topleft = -20, int(dsr.h * .35)
|
||||
self.add_frame(load(self.get_resource("Big_Tony.png")).convert_alpha())
|
||||
self.load_from_path(self.get_resource("newTony/TonyShirtHead"), True)
|
||||
self.add_frameset([0], name="static")
|
||||
self.add_frameset(range(1, len(self.frames)), name="board")
|
||||
|
||||
def set_frameset(self, name):
|
||||
Sprite.set_frameset(self, name)
|
||||
self.get_current_frameset().reset()
|
||||
self.set_framerate(100)
|
||||
if name == "board":
|
||||
self.board.get_current_frameset().reset()
|
||||
self.board.unhide()
|
||||
self.board.set_framerate(100)
|
||||
self.board.halt()
|
||||
elif name == "static":
|
||||
self.board.hide()
|
||||
|
||||
def update(self):
|
||||
save = self.get_display_surface()
|
||||
intermediate_surface = Surface(self.location.size, SRCALPHA)
|
||||
self.display_surface = intermediate_surface
|
||||
Sprite.update(self)
|
||||
self.display_surface = 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_game().title.active:
|
||||
self.get_game().platform.update()
|
||||
self.get_game().chemtrails.update()
|
||||
frameset = self.get_current_frameset()
|
||||
if frameset.name == "board":
|
||||
self.board.get_current_frameset().current_index = frameset.current_index
|
||||
if frameset.current_index == len(frameset.order) - 1:
|
||||
self.set_framerate(3000)
|
||||
else:
|
||||
self.set_framerate(100)
|
||||
self.board.update()
|
||||
|
||||
|
||||
class Video(Sprite):
|
||||
|
@ -375,6 +415,35 @@ class Video(Sprite):
|
|||
self.clear_frames()
|
||||
self.add_frame(copy)
|
||||
|
||||
class Logo(Sprite):
|
||||
|
||||
def __init__(self, parent):
|
||||
Sprite.__init__(self, parent)
|
||||
dsr = self.get_display_surface().get_rect()
|
||||
self.load_from_path(self.get_resource("Title_tile.png"), True)
|
||||
for y in range(0, dsr.h + self.location.h, self.location.h):
|
||||
for x in range(0, dsr.w + self.location.w, self.location.w):
|
||||
if x != 0 or y != 0:
|
||||
self.add_location((x, y))
|
||||
self.effect = Sprite(self, 100)
|
||||
palette = (255, 255, 255), (255, 255, 128), (255, 255, 0)
|
||||
thickness = 8
|
||||
for offset in range(len(palette)):
|
||||
frame = Surface(dsr.size)
|
||||
for x in range(0, dsr.w, thickness):
|
||||
frame.fill(palette[(offset + x) % len(palette)], (x, 0, thickness, dsr.h))
|
||||
self.effect.add_frame(frame)
|
||||
|
||||
def update(self):
|
||||
self.effect.update()
|
||||
# tiled background
|
||||
self.move(-2, 2)
|
||||
if self.location.right < 0:
|
||||
self.move(self.location.w)
|
||||
if self.location.top > 0:
|
||||
self.move(dy=-self.location.h)
|
||||
Sprite.update(self, flags=BLEND_RGBA_MIN)
|
||||
|
||||
|
||||
class Title(Animation):
|
||||
|
||||
|
@ -387,31 +456,17 @@ class Title(Animation):
|
|||
ds = self.get_display_surface()
|
||||
dsr = ds.get_rect()
|
||||
self.plank.location.center = dsr.center
|
||||
# self.angle = choice((pi / 4, 3 * pi / 4, 5 * pi / 4, 7 * pi / 4))
|
||||
self.angle = pi / 8
|
||||
self.background = Sprite(self)
|
||||
self.background.load_from_path(self.get_resource("Title_tile.png"), True)
|
||||
for y in range(0, dsr.h + self.background.location.h, self.background.location.h):
|
||||
for x in range(0, dsr.w + self.background.location.w, self.background.location.w):
|
||||
if x != 0 or y != 0:
|
||||
self.background.add_location((x, y))
|
||||
self.effect = Sprite(self, 100)
|
||||
palette = (255, 255, 255), (255, 255, 128), (255, 255, 0)
|
||||
thickness = 8
|
||||
for offset in range(len(palette)):
|
||||
frame = Surface(dsr.size)
|
||||
for x in range(0, dsr.w, thickness):
|
||||
frame.fill(palette[(offset + x) % len(palette)], (x, 0, thickness, dsr.h))
|
||||
self.effect.add_frame(frame)
|
||||
self.video = Video(self, 320)
|
||||
self.video.location.center = 329, 182
|
||||
self.register(self.show_video, self.hide_video)
|
||||
self.show_video()
|
||||
|
||||
def reset(self):
|
||||
self.first_pressed = False
|
||||
self.first_pressed_elapsed = 0
|
||||
# self.first_pressed = False
|
||||
# self.first_pressed_elapsed = 0
|
||||
self.unlock_index = 0
|
||||
self.get_game().platform.set_glowing(self.get_game().platform.get_buttons_from_edges([self.UNLOCK_MOVES[0]]))
|
||||
|
||||
def activate(self):
|
||||
self.active = True
|
||||
|
@ -419,6 +474,7 @@ class Title(Animation):
|
|||
platform.activate()
|
||||
platform.set_glowing(platform.get_buttons_from_edges([self.UNLOCK_MOVES[self.unlock_index]]))
|
||||
self.get_game().chemtrails.activate()
|
||||
self.get_game().tony.set_frameset("static")
|
||||
|
||||
def deactivate(self):
|
||||
self.active = False
|
||||
|
@ -464,11 +520,14 @@ class Title(Animation):
|
|||
|
||||
def show_video(self):
|
||||
self.video.unhide()
|
||||
self.play(self.hide_video, delay=16000, play_once=True)
|
||||
self.play(self.hide_video, delay=21000, play_once=True)
|
||||
self.get_game().tony.set_frameset("static")
|
||||
self.reset()
|
||||
|
||||
def hide_video(self):
|
||||
self.video.hide()
|
||||
self.play(self.show_video, delay=7000, play_once=True)
|
||||
self.play(self.show_video, delay=10000, play_once=True)
|
||||
self.get_game().tony.set_frameset("board")
|
||||
|
||||
def update(self):
|
||||
'''
|
||||
|
@ -478,20 +537,12 @@ class Title(Animation):
|
|||
if self.active:
|
||||
ds = self.get_display_surface()
|
||||
dsr = ds.get_rect()
|
||||
self.effect.update()
|
||||
# tiled background
|
||||
self.background.move(-2, 2)
|
||||
if self.background.location.right < 0:
|
||||
self.background.move(self.background.location.w)
|
||||
if self.background.location.top > 0:
|
||||
self.background.move(dy=-self.background.location.h)
|
||||
self.background.update(flags=BLEND_RGBA_MIN)
|
||||
self.get_game().tony.update()
|
||||
self.get_game().logo.update()
|
||||
# advance unlock pattern
|
||||
platform = self.get_game().platform
|
||||
if not self.get_game().wipe.is_playing() and platform.get_edge_pressed() == self.UNLOCK_MOVES[self.unlock_index]:
|
||||
self.first_pressed = True
|
||||
self.first_pressed_elapsed = 0
|
||||
# self.first_pressed = True
|
||||
# self.first_pressed_elapsed = 0
|
||||
if self.unlock_index == len(self.UNLOCK_MOVES) - 1:
|
||||
platform.set_glowing([])
|
||||
self.get_game().wipe.start(self.start_game)
|
||||
|
@ -501,12 +552,11 @@ class Title(Animation):
|
|||
platform.set_glowing(platform.get_buttons_from_edges([self.UNLOCK_MOVES[self.unlock_index]]))
|
||||
self.get_audio().play_sfx("land_0")
|
||||
# reset unlock pattern if idle
|
||||
if self.first_pressed:
|
||||
self.first_pressed_elapsed += self.get_game().time_filter.get_last_frame_duration()
|
||||
if self.first_pressed_elapsed > 1000 * 60 * 1:
|
||||
self.reset()
|
||||
platform.update()
|
||||
self.get_game().chemtrails.update()
|
||||
# if self.first_pressed:
|
||||
# self.first_pressed_elapsed += self.get_game().time_filter.get_last_frame_duration()
|
||||
# if self.first_pressed_elapsed > 1000 * 10:
|
||||
# self.reset()
|
||||
self.get_game().tony.update()
|
||||
# bounce the gif around the screen
|
||||
if self.video.location.right > dsr.right or self.video.location.left < dsr.left:
|
||||
self.angle = reflect_angle(self.angle, 0)
|
||||
|
@ -524,6 +574,7 @@ class Title(Animation):
|
|||
self.video.move(dx, dy)
|
||||
if platform.get_pressed():
|
||||
self.video.hide()
|
||||
self.get_game().tony.set_frameset("static")
|
||||
self.halt(self.show_video)
|
||||
self.halt(self.hide_video)
|
||||
self.play(self.show_video, delay=10000, play_once=True)
|
||||
|
@ -1994,6 +2045,7 @@ class Ending(Animation):
|
|||
dsr = self.get_display_surface().get_rect()
|
||||
self.text = RainbowSprite(self, foreground, 180, 200)
|
||||
self.text.location.midtop = dsr.centerx, 80
|
||||
self.get_game().tony.set_frameset("static")
|
||||
|
||||
def start(self):
|
||||
self.advance_prompt.cancel_first_press()
|
||||
|
@ -2028,6 +2080,7 @@ class Ending(Animation):
|
|||
else:
|
||||
self.start_wipe()
|
||||
self.advance_prompt.cancel_first_press()
|
||||
self.get_game().logo_background.update()
|
||||
self.get_game().tony.update()
|
||||
self.slime_bag.update()
|
||||
dsr = self.get_display_surface().get_rect()
|
||||
|
|
2
lib/pgfw
2
lib/pgfw
|
@ -1 +1 @@
|
|||
Subproject commit 3dd467bea3bd4c1dc2aa4773d1f5098e62c22e05
|
||||
Subproject commit 6c9554a2559d4ae878aeeeb8e356fd8cc3618218
|
Loading…
Reference in New Issue