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():