From 265f886b232cb1c41b47eaa55e0200f6e96a7b91 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 7 May 2015 20:04:43 +0100 Subject: [PATCH] modified HUD functions --- game.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/game.py b/game.py index 6577ab4..9325706 100644 --- a/game.py +++ b/game.py @@ -7,15 +7,23 @@ from player import Shooter from assets import Textures, Levels from target import Target + PLAYING_GAME = False WINDOW_SIZE = (640,480) FPS = 120 -def rounding(x, base): return int(base * round(float(x)/base)) def update_score(window, score): font = pygame.font.SysFont(None, 30, bold=False) - window.blit(font.render("Score: {}".format(int(score)), True, (12,123,190)), (50, WINDOW_SIZE[1] - 30)) + window.blit(font.render("Score: {}".format(int(score)), True, (255,0,0)), (25, WINDOW_SIZE[1] - 30)) + +def update_level(window, level): + font = pygame.font.SysFont(None, 20, bold=True) + window.blit(font.render("Level: {}".format(int(level)+1), True, (0,255,0)), (8.7*WINDOW_SIZE[0]/10, WINDOW_SIZE[1] - 30)) + +def update_lives(window, lives): + font = pygame.font.SysFont(None, 30, bold=False) + window.blit(font.render("Lives Remaining: {}".format(int(lives)), True, (0,0,255)), (4.5*WINDOW_SIZE[0]/10, WINDOW_SIZE[1] - 30)) def initialise(menu, options): pygame.mixer.pre_init(44100, -16, 2, 2048)