From 983951e261cd527f6c3d63bc04b3c4076b95979a Mon Sep 17 00:00:00 2001 From: Arthur 'Grizzly' Grisel-Davy Date: Sat, 2 May 2020 00:26:30 -0400 Subject: [PATCH] Add basic ammo count --- models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models.py b/models.py index 04478e8..288b848 100644 --- a/models.py +++ b/models.py @@ -56,12 +56,17 @@ class Hud(): def __init__(self,player): self.player = player self.ratio = 1 + self.font = pygame.font.SysFont('GlacialIndifference-Regular', 72) def draw(self,surface): # draw the life bar pygame.draw.rect(surface,(255,0,0),(10,10,round(self.player.life/100*surface.get_width()/3),30),0) pygame.draw.rect(surface,(255,255,255),(10,10,int(surface.get_width()/3),30),3) + text = self.font.render(str(self.player.ammo), True, (255, 255, 255)) + surface.blit(text, (int(surface.get_width()-1.5*text.get_width()),int(surface.get_height()-1.5*text.get_height()))) + + class Carte(): def __init__(self,mapname): @@ -251,6 +256,7 @@ class Player(): new_proj = Projectile(name,self.texture_proj,(self.posx,self.posy),20,self.degres_canon) self.projectiles.append(new_proj) self.last_fire = time() + self.ammo = self.ammo -1 class Enemy():