gif alpha and timing config options

This commit is contained in:
Frank DeMarco 2020-10-29 13:40:05 -04:00
parent 6dd202c8e3
commit 9b6d5e5af2
2 changed files with 14 additions and 5 deletions

16
NS.py
View File

@ -52,11 +52,16 @@ class NS(Game, Animation):
{ {
"time": "time":
{ {
"int": ["timer-max-time", "timer-start-time", "timer-addition", "sword-delay"] "int": ["timer-max-time", "timer-start-time", "timer-addition", "sword-delay",
"attract-gif-length", "attract-board-length"]
}, },
"input": "input":
{ {
"bool": "serial" "bool": "serial"
},
"display":
{
"float": "attract-gif-alpha"
} }
}) })
Animation.__init__(self, self) Animation.__init__(self, self)
@ -391,8 +396,9 @@ class Video(Sprite):
self.gif = self.gifs[1] self.gif = self.gifs[1]
self.mask = Surface([diameter] * 2, SRCALPHA) self.mask = Surface([diameter] * 2, SRCALPHA)
rect = self.mask.get_rect() rect = self.mask.get_rect()
filled_circle(self.mask, rect.centerx, rect.centery, rect.centerx, (0, 0, 0)) alpha = int(self.get_configuration("display", "attract-gif-alpha") * 255)
filled_circle(self.mask, rect.centerx, rect.centery, rect.centerx - 2, (255, 255, 255)) filled_circle(self.mask, rect.centerx, rect.centery, rect.centerx, (0, 0, 0, alpha))
filled_circle(self.mask, rect.centerx, rect.centery, rect.centerx - 2, (255, 255, 255, alpha))
self.add_frame(self.mask) self.add_frame(self.mask)
self.play() self.play()
@ -521,13 +527,13 @@ class Title(Animation):
def show_video(self): def show_video(self):
self.video.unhide() self.video.unhide()
self.play(self.hide_video, delay=21000, play_once=True) self.play(self.hide_video, delay=self.get_configuration("time", "attract-gif-length"), play_once=True)
self.get_game().tony.set_frameset("static") self.get_game().tony.set_frameset("static")
self.reset() self.reset()
def hide_video(self): def hide_video(self):
self.video.hide() self.video.hide()
self.play(self.show_video, delay=10000, play_once=True) self.play(self.show_video, delay=self.get_configuration("time", "attract-board-length"), play_once=True)
self.get_game().tony.set_frameset("board") self.get_game().tony.set_frameset("board")
def update(self): def update(self):

3
config
View File

@ -12,6 +12,7 @@ caption = Scrapeboard
show-framerate = no show-framerate = no
dimensions = 640, 480 dimensions = 640, 480
fullscreen = no fullscreen = no
attract-gif-alpha = .95
[mouse] [mouse]
visible = False visible = False
@ -33,3 +34,5 @@ timer-max-time = 10000
timer-start-time = 7000 timer-start-time = 7000
timer-addition = 1000 timer-addition = 1000
sword-delay = 300 sword-delay = 300
attract-gif-length = 10000
attract-board-length = 4000