lvl indicatior
This commit is contained in:
parent
a8036b32a1
commit
d86f263987
Binary file not shown.
9
agent.py
9
agent.py
@ -34,12 +34,14 @@ class Agent(pygame.sprite.Sprite):
|
|||||||
self.max_health = 1000
|
self.max_health = 1000
|
||||||
self.health_bar_length = 300
|
self.health_bar_length = 300
|
||||||
self.health_ratio = self.max_health/self.health_bar_length
|
self.health_ratio = self.max_health/self.health_bar_length
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.health_bar()
|
self.health_bar()
|
||||||
self.movement()
|
self.movement()
|
||||||
self.collide_mob()
|
self.collide_mob()
|
||||||
|
self.disp_level()
|
||||||
|
|
||||||
self.rect.x += self.x_change
|
self.rect.x += self.x_change
|
||||||
self.collide_blocks('x')
|
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, (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)
|
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 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
|
# brakuje dodania miejsca w którym agent się leczy
|
||||||
|
4
main.py
4
main.py
@ -19,6 +19,9 @@ class Game:
|
|||||||
self.BACKGROUND_IMG= pygame.image.load("./zdjecia/podloze.jpg")
|
self.BACKGROUND_IMG= pygame.image.load("./zdjecia/podloze.jpg")
|
||||||
self.BACKGROUND = pygame.transform.scale(self.BACKGROUND_IMG,(64,64))
|
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]
|
#self.ORK_LIST = [self.ARCHER_ORK,self.INFANTRY_ORK2, self.INFATRY_ORK]
|
||||||
|
|
||||||
pygame.display.set_caption('Do_Nazwania')
|
pygame.display.set_caption('Do_Nazwania')
|
||||||
@ -60,6 +63,7 @@ class Game:
|
|||||||
pygame.draw.rect(self.SCREEN, BLACK, self.rect, 1)
|
pygame.draw.rect(self.SCREEN, BLACK, self.rect, 1)
|
||||||
self.all_sprites.draw(self.SCREEN)
|
self.all_sprites.draw(self.SCREEN)
|
||||||
self.rock_sprites.draw(self.SCREEN)
|
self.rock_sprites.draw(self.SCREEN)
|
||||||
|
self.SCREEN.blit(self.LVL_ICON, (340 ,780))
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
BIN
zdjecia/lvl_icon.png
Normal file
BIN
zdjecia/lvl_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue
Block a user