unknown class

This commit is contained in:
s473569 2023-03-31 15:26:54 +02:00
parent e2d816fcac
commit 82b21db6c4
4 changed files with 42 additions and 0 deletions

View File

@ -77,6 +77,15 @@ class Agent(pygame.sprite.Sprite):
hits_infantry_ork = pygame.sprite.spritecollide(self, self.game.infantry_orks, False)
hits_infantry_ork2 = pygame.sprite.spritecollide(self, self.game.infantry_orks2, False)
hits_sauron = pygame.sprite.spritecollide(self, self.game.sauronL, False)
#hits_unknown_mob = pygame.sprite.spritecollide(self, self.game.unknown_mobs, False) #unknown mob
#if hits_unknown_mob:
# self.game.unknown_mob.kill()
# self.game.archer_orks = pygame.sprite.LayeredUpdates()
# self.game.archer_ork = Archer_ork(self,3,2)
if hits_archer_ork:
if self.game.archer_ork.level > self.level or self.game.archer_ork.damage > self.health:
self.kill()

View File

@ -6,6 +6,7 @@ from archer_ork import *
from infantry_ork import *
from infantry_ork2 import *
from sauron import *
#from unknown_mob import * #unknown mob
class Game:
@ -29,14 +30,17 @@ class Game:
self.infantry_orks = pygame.sprite.LayeredUpdates()
self.infantry_orks2 = pygame.sprite.LayeredUpdates()
self.sauronL = pygame.sprite.LayeredUpdates()
#self.unknown_mobs = pygame.sprite.LayeredUpdates() #unknown mob
self.agent = Agent(self,1,1)
self.archer_ork = Archer_ork(self,10,10)
self.infantry_ork = Infantry_ork(self,10,4)
self.infantry_ork2 = Infantry_ork2(self,6,3)
self.sauron = Sauron(self, 1, 10)
#self.unknown_mob = Unknown_mob(self,8,8) #unknown mob
for y in range(5):
self.rock = Rocks(self,3,y)
def update(self):
self.all_sprites.update()

29
unknown_mob.py Normal file
View File

@ -0,0 +1,29 @@
import pygame
from config import *
class Unknown_mob(pygame.sprite.Sprite):
def __init__(self, game, x, y):
self.game = game
self.groups = self.game.all_sprites, self.game.unknown_mobs
pygame.sprite.Sprite.__init__(self, self.groups)
self.x = x * TILE_SIZE
self.y = y * TILE_SIZE
self.width = TILE_SIZE
self.height = TILE_SIZE
self.UNKNOWN_MOB_IMG = pygame.image.load("./zdjecia/dragon.jpg")
self.UKNOWN_MOB = pygame.transform.scale(self.UNKNOWN_MOB_IMG,(64,64))
self.image = pygame.Surface([self.width, self.height])
self.image.blit(self.UKNOWN_MOB, (0,0))
self.image.set_colorkey((0, 0, 0))
self.rect = self.image.get_rect()
self.rect.x = self.x
self.rect.y = self.y
self.level = 1
self.damage = 50*self.level

BIN
zdjecia/dragon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB