score padding

This commit is contained in:
Frank DeMarco 2015-07-23 06:33:20 -04:00
parent 539e61c054
commit b2a7599d5a
4 changed files with 22 additions and 20 deletions

2
config
View File

@ -34,7 +34,7 @@ triangles = aud/777.ogg
hit = aud/Skinball.wav
miss = aud/0Sj-99_Em.wav
end = aud/Sarcophagus-Soar-and-to-Commune.ogg
noise = aud/Heat.ogg
noise = aud/Heat-quiet.ogg
[interpolate]
volume = C 0.0 0.0, 16.0 0.61, 80.0 1.0

View File

@ -183,6 +183,8 @@ class Scoreboard(GameChild):
SPACING = 70
MARGIN = 30
BLINK_INTERVAL = 400
PADDING = 6
BORDER = 1
def __init__(self, parent):
GameChild.__init__(self, parent)
@ -198,7 +200,7 @@ class Scoreboard(GameChild):
scores.append((float(fields[0]), int(fields[1]), fields[2]))
self.sprites = sprites = []
font_path = self.get_resource("display", "scoreboard-font-path")
sizes = [14] * 5
sizes = [24] * 5
for ii, score in enumerate(sorted(scores, key=lambda score: score[1],
reverse=True)[:len(sizes)]):
font = Font(font_path, sizes[ii])
@ -214,14 +216,14 @@ class Scoreboard(GameChild):
rect.center = surface.get_rect().center
surface.blit(score_plate, rect)
sprites[ii][1].add_frame(render_box(font, score_text, False, color,
self.BACKGROUND, self.FOREGROUND, 1, 2))
self.BACKGROUND, self.FOREGROUND, self.BORDER, self.PADDING))
sprites[ii][0].add_frame(render_box(font, score[2], False, color,
self.BACKGROUND, self.FOREGROUND, 1, 2))
self.BACKGROUND, self.FOREGROUND, self.BORDER, self.PADDING))
if score[1] == self.most_recent_score:
sprites[ii][1].add_frame(render_box(font, score_text, False, self.NEW,
self.BACKGROUND, self.FOREGROUND, 1, 2))
self.BACKGROUND, self.FOREGROUND, self.BORDER, self.PADDING))
sprites[ii][0].add_frame(render_box(font, score[2], False, self.NEW,
self.BACKGROUND, self.FOREGROUND, 1, 2))
self.BACKGROUND, self.FOREGROUND, self.BORDER, self.PADDING))
sprites[ii][0].location.left = self.MARGIN
sprites[ii][1].location.right = self.get_display_surface().get_rect().right - self.MARGIN
y = self.get_display_surface().get_rect().centery + self.SPACING * (ii - len(sizes) / 2)
@ -559,8 +561,8 @@ class Total(Sprite):
def __init__(self, parent):
Sprite.__init__(self, parent, 68)
self.deactivate()
self.font = Font(self.get_resource("display", "score-font-path"), 48)
self.font.set_italic(True)
self.font = Font(self.get_resource("display", "score-font-path"), 72)
# self.font.set_italic(True)
def deactivate(self):
self.active = False
@ -570,8 +572,8 @@ class Total(Sprite):
score = ""
for ch in str(int(round(self.get_game().triangles.score))):
score += ch + " "
colors = (255, 255, 80), (80, 255, 255), (255, 80, 255), \
(255, 120, 60), (60, 255, 120), (120, 60, 255)
colors = (255, 255, 180), (180, 255, 255), (255, 180, 255), \
(255, 220, 160), (160, 255, 220), (220, 160, 255)
template = Surface((self.display_surface.get_width(), 100))
transparent_color = (255, 0, 255)
template.fill(transparent_color)
@ -584,17 +586,18 @@ class Total(Sprite):
template.fill((255, 128, 128), (0, 78, tr.w, 1))
template.fill((255, 0, 0), (0, 79, tr.w, 1))
for _ in xrange(20):
surface = template.copy()
polygon(surface, choice(colors), ((tr.centerx - 7, 19),
(tr.centerx, 0),
(tr.centerx + 7, 19)))
# surface = template.copy()
surface = Surface(template.get_size(), SRCALPHA)
# polygon(surface, choice(colors), ((tr.centerx - 7, 19),
# (tr.centerx, 0),
# (tr.centerx + 7, 19)))
text = self.font.render(score, True, choice(colors))
rect = text.get_rect()
rect.center = tr.centerx, tr.centery + 2
surface.blit(text, rect)
polygon(surface, choice(colors), ((tr.centerx - 7, 80),
(tr.centerx, tr.h - 1),
(tr.centerx + 7, 80)))
# polygon(surface, choice(colors), ((tr.centerx - 7, 80),
# (tr.centerx, tr.h - 1),
# (tr.centerx + 7, 80)))
self.add_frame(surface)
self.location.center = self.display_surface.get_rect().center
self.active = True

BIN
resource/aud/Heat-quiet.ogg Normal file

Binary file not shown.

View File

@ -3,6 +3,5 @@
1398631170.296798 45 SIV
1398635621.7 25 SIV
1398635792.99 10 SIV
1437514837.26 206 SIV
1437514932.23 22 SIV
1437514988.25 88 SIV
1437647034.17 214 SIV
1437647409.07 32 SIV