po zabiciu bohater traci zdrowie(testowo ma 10000 zdrowia),po zabiciu moba dostaje +1 lvl, gra sie konczy po zabiciu saurona, porusza sie wolniej(dla wygody)

This commit is contained in:
Paralyzecl 2023-03-31 12:01:43 +02:00
parent 46e766afcc
commit e2d816fcac
2 changed files with 15 additions and 7 deletions

View File

@ -29,7 +29,7 @@ class Agent(pygame.sprite.Sprite):
self.rect.y = self.y
self.level = 1
self.health = 100*self.level
self.health = 10000*self.level
def update(self):
self.movement()
@ -46,13 +46,13 @@ class Agent(pygame.sprite.Sprite):
def movement(self):
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT] and self.rect.x > 0:
self.x_change -= TILE_SIZE
self.x_change -= TILE_SIZE/2
if keys[pygame.K_RIGHT] and self.rect.x < 832 - 64:
self.x_change += TILE_SIZE
self.x_change += TILE_SIZE/2
if keys[pygame.K_UP] and self.rect.y > 0:
self.y_change -= TILE_SIZE
self.y_change -= TILE_SIZE/2
if keys[pygame.K_DOWN] and self.rect.y < 832 - 64:
self.y_change += TILE_SIZE
self.y_change += TILE_SIZE/2
def collide_blocks(self, direction):
if direction == "x":
@ -83,6 +83,8 @@ class Agent(pygame.sprite.Sprite):
self.game.new()
else:
self.game.archer_ork.kill()
self.health=self.health-self.game.archer_ork.damage
self.level+=self.level
#zmniejszenie życia o damage moba
#level up
if hits_infantry_ork:
@ -91,14 +93,18 @@ class Agent(pygame.sprite.Sprite):
self.game.new()
else:
self.game.infantry_ork.kill()
self.health=self.health-self.game.infantry_ork.damage
self.level+=self.level
#zmniejszenie życia o damage moba
#level up
if hits_infantry_ork2:
if self.game.infantry_ork2.level > self.level or self.game.infantry2_ork.damage > self.health:
if self.game.infantry_ork2.level > self.level or self.game.infantry_ork2.damage > self.health:
self.kill()
self.game.new()
else:
self.game.infantry_ork2.kill()
self.health=self.health-self.game.infantry_ork2.damage
self.level+=self.level
#zmniejszenie życia o damage moba
#level up
if hits_sauron:
@ -107,6 +113,8 @@ class Agent(pygame.sprite.Sprite):
self.game.new()
else:
self.game.sauron.kill()
self.level+=self.level
pygame.quit()
#zmniejszenie życia o damage moba
#level up

View File

@ -31,7 +31,7 @@ class Game:
self.sauronL = pygame.sprite.LayeredUpdates()
self.agent = Agent(self,1,1)
self.archer_ork = Archer_ork(self,10,10)
self.infantry_ork = Infantry_ork(self,5,1)
self.infantry_ork = Infantry_ork(self,10,4)
self.infantry_ork2 = Infantry_ork2(self,6,3)
self.sauron = Sauron(self, 1, 10)
for y in range(5):