diff --git a/Game_Client/Assets/Arena/field.png b/Game_Client/Assets/Arena/field.png new file mode 100644 index 0000000..472f0a1 Binary files /dev/null and b/Game_Client/Assets/Arena/field.png differ diff --git a/Game_Client/Classes/Objects/BoardField.py b/Game_Client/Classes/Objects/BoardField.py index fb336bd..8bb3e03 100644 --- a/Game_Client/Classes/Objects/BoardField.py +++ b/Game_Client/Classes/Objects/BoardField.py @@ -1,22 +1,26 @@ import pygame -class BoardField(): +class BoardField(pygame.sprite.Sprite): __name:str __side:str __type:str __pos:pygame.Vector2 __size:tuple __color:tuple = (255,255,255) - _rect:pygame.Rect + image:pygame.image + rect:pygame.rect - def __init__(self, name:str, side:str, type:str, pos:pygame.Vector2, size:tuple, color:tuple): + def __init__(self, name:str, side:str, type:str, pos:pygame.Vector2, size:tuple, color:tuple, imagePath:str="Assets/Arena/field.png"): + pygame.sprite.Sprite.__init__(self) self.__name = name self.__side = side self.__type = type self.__pos = pos self.__size = size self.__color = color - self.__rect = pygame.Rect(pos.x, pos.y, size[0], size[1]) + self.image = pygame.image.load(imagePath).convert_alpha() + self.rect = self.image.get_rect() + self.rect.center = self.__pos def getName(self) -> str: return self.__name @@ -37,7 +41,10 @@ class BoardField(): return self.__color def getRect(self) -> pygame.Rect: - return self.__rect + return self.rect + + def getImage(self) -> pygame.image: + return self.image def setName(self, name:str) -> str: self.__name = name diff --git a/Game_Client/Classes/Objects/World.py b/Game_Client/Classes/Objects/World.py index 4a82b34..9109bc4 100644 --- a/Game_Client/Classes/Objects/World.py +++ b/Game_Client/Classes/Objects/World.py @@ -15,17 +15,15 @@ class World(): self.buildGameWorld() def buildGameWorld(self): - # TODO: rebuild these to use the BoardField Class and to append them to the __boardFields list # construct elements arround the playerfield # Todo add lifepoint label for player and enemy and make them scriptable - pRow1Height = ((2 * self.__cardHeight) + 60) - pRow2Height = ((2 * self.__cardHeight) + self.__cardHeight + 70) - eRow1Height = 15 - eRow2Height = (self.__cardHeight + 25) + eRow1Height = 105 + eRow2Height = (self.__cardHeight + 110) + pRow1Height = ((2 * self.__cardHeight) + 145) + pRow2Height = ((2 * self.__cardHeight) + self.__cardHeight + 150) - - eDeckPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), 15) - eGravePos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), (self.__cardHeight + 25)) + eDeckPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), eRow1Height) + eGravePos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), eRow2Height) pGravePos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), pRow1Height) pDeckPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), pRow2Height) diff --git a/Game_Client/Classes/Objects/__pycache__/BoardField.cpython-311.pyc b/Game_Client/Classes/Objects/__pycache__/BoardField.cpython-311.pyc index 1481fa3..f4e3112 100644 Binary files a/Game_Client/Classes/Objects/__pycache__/BoardField.cpython-311.pyc and b/Game_Client/Classes/Objects/__pycache__/BoardField.cpython-311.pyc differ diff --git a/Game_Client/Classes/Objects/__pycache__/World.cpython-311.pyc b/Game_Client/Classes/Objects/__pycache__/World.cpython-311.pyc index c934dd5..9711a20 100644 Binary files a/Game_Client/Classes/Objects/__pycache__/World.cpython-311.pyc and b/Game_Client/Classes/Objects/__pycache__/World.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/App.py b/Game_Client/Classes/System/App.py index 6af8407..a14731e 100644 --- a/Game_Client/Classes/System/App.py +++ b/Game_Client/Classes/System/App.py @@ -74,10 +74,12 @@ class App: if field.getSide() == "Player": if field.getType() == "MonsterField" and card.getType() == "MonsterCard": # todo: resize card so that it fits into the card field - pygame.transform.scale(card.image,(int((field.getRect().width - 10)),int((field.getRect().height - 10)))) - card.rect.center = field.getRect().center + # card.image = pygame.transform.scale(card.image, (field.getSize()[0] - 10, field.getSize()[1] - 10)) + card.rect.center = field.rect.center + field.image = card.image.copy() card.setDragging(False) - self.__window.getScreen().blit(card.image, field.getRect().center) + # card.kill() + elif event.type == pygame.MOUSEBUTTONUP: if event.button == 1: # Wenn linke Maustaste losgelassen wird diff --git a/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc b/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc index 460e4e3..322bc39 100644 Binary files a/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc and b/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc differ