Add basic ammo count
This commit is contained in:
parent
f0eec65dad
commit
983951e261
1 changed files with 6 additions and 0 deletions
|
@ -56,12 +56,17 @@ class Hud():
|
||||||
def __init__(self,player):
|
def __init__(self,player):
|
||||||
self.player = player
|
self.player = player
|
||||||
self.ratio = 1
|
self.ratio = 1
|
||||||
|
self.font = pygame.font.SysFont('GlacialIndifference-Regular', 72)
|
||||||
|
|
||||||
def draw(self,surface):
|
def draw(self,surface):
|
||||||
# draw the life bar
|
# 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,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)
|
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():
|
class Carte():
|
||||||
def __init__(self,mapname):
|
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)
|
new_proj = Projectile(name,self.texture_proj,(self.posx,self.posy),20,self.degres_canon)
|
||||||
self.projectiles.append(new_proj)
|
self.projectiles.append(new_proj)
|
||||||
self.last_fire = time()
|
self.last_fire = time()
|
||||||
|
self.ammo = self.ammo -1
|
||||||
|
|
||||||
|
|
||||||
class Enemy():
|
class Enemy():
|
||||||
|
|
Loading…
Reference in a new issue