diff --git a/game.py b/game.py index 3861a43..7ac1e65 100644 --- a/game.py +++ b/game.py @@ -8,7 +8,7 @@ import pygame from pygame.locals import * from support import colors -import hud +from interface import hud # Move this outside screen_width = 800 @@ -26,6 +26,8 @@ def main(): while running: # Limit to 50 fps time_passed = clock.tick(30) + my_hud = hud.draw_hud(10) + screen.blit(my_hud, (0,0)) for event in pygame.event.get(): if event.type == pygame.QUIT: diff --git a/interface/__init__.py b/interface/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/interface/hud.py b/interface/hud.py new file mode 100644 index 0000000..b309cfa --- /dev/null +++ b/interface/hud.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import pygame +from pygame.locals import * +from support.colors import * + +def draw_hud(score): + hud = pygame.Surface((800, 100)) + + # Adding items to the hud + hud.blit(draw_score(score), (0, 0)) + #hud.blit(get_timeleft, (200, 0)) + return hud + +def draw_score(score): + font = pygame.font.Font(None, 30) + score = font.render('Score: ' + str(score), 0, WHITE) + return score