lvl indicatior

This commit is contained in:
wojciech goralewski 2023-04-18 22:15:23 +02:00
parent a8036b32a1
commit d86f263987
4 changed files with 11 additions and 2 deletions

Binary file not shown.

View File

@ -36,10 +36,12 @@ class Agent(pygame.sprite.Sprite):
self.health_ratio = self.max_health/self.health_bar_length
def update(self):
self.health_bar()
self.movement()
self.collide_mob()
self.disp_level()
self.rect.x += self.x_change
self.collide_blocks('x')
@ -154,8 +156,11 @@ class Agent(pygame.sprite.Sprite):
pygame.draw.rect(self.game.SCREEN, (0,255,0), (10,780,self.current_health/self.health_ratio,25))
pygame.draw.rect(self.game.SCREEN, (255,255,255), (10,780,self.health_bar_length, 25),2)
def disp_level(self):
font = pygame.font.SysFont(None, 40)
lvlDisplay = font.render(str(self.level), 1, WHITE)
pygame.draw.rect(self.game.SCREEN, BLACK, (370, 780, 40, 40))
self.game.SCREEN.blit(lvlDisplay, (370,780))
# brakuje levelowania postaci gdy zabije moba, jest zrobione tylko, że jeśli za wysoki poziom, lub brak życia to ginie i od nowa zaczyna
# brakuje dodania miejsca w którym agent się leczy

View File

@ -19,6 +19,9 @@ class Game:
self.BACKGROUND_IMG= pygame.image.load("./zdjecia/podloze.jpg")
self.BACKGROUND = pygame.transform.scale(self.BACKGROUND_IMG,(64,64))
self.LVL_ICON_PNG = pygame.image.load("./zdjecia/lvl_icon.png")
self.LVL_ICON = pygame.transform.scale(self.LVL_ICON_PNG,(24,24))
#self.ORK_LIST = [self.ARCHER_ORK,self.INFANTRY_ORK2, self.INFATRY_ORK]
pygame.display.set_caption('Do_Nazwania')
@ -60,6 +63,7 @@ class Game:
pygame.draw.rect(self.SCREEN, BLACK, self.rect, 1)
self.all_sprites.draw(self.SCREEN)
self.rock_sprites.draw(self.SCREEN)
self.SCREEN.blit(self.LVL_ICON, (340 ,780))
pygame.display.update()
def main(self):

BIN
zdjecia/lvl_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB