diff --git a/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc index db2cd58..512380d 100644 Binary files a/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc and b/Game_Client/Classes/Game/Cards/__pycache__/Card.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Cards/__pycache__/MonsterCard.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/MonsterCard.cpython-311.pyc index 438e237..1911997 100644 Binary files a/Game_Client/Classes/Game/Cards/__pycache__/MonsterCard.cpython-311.pyc and b/Game_Client/Classes/Game/Cards/__pycache__/MonsterCard.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc index 1832c8a..cbbd764 100644 Binary files a/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc and b/Game_Client/Classes/Game/Cards/__pycache__/SpellCard.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc b/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc index b7fcf13..9c588ed 100644 Binary files a/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc and b/Game_Client/Classes/Game/Cards/__pycache__/TrapCard.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Events/__pycache__/GameStart.cpython-311.pyc b/Game_Client/Classes/Game/Events/__pycache__/GameStart.cpython-311.pyc index 16e7390..40ebc60 100644 Binary files a/Game_Client/Classes/Game/Events/__pycache__/GameStart.cpython-311.pyc and b/Game_Client/Classes/Game/Events/__pycache__/GameStart.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc b/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc index a50672e..726c1a4 100644 Binary files a/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc and b/Game_Client/Classes/Game/Events/__pycache__/Login.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/Events/__pycache__/PlaceCard.cpython-311.pyc b/Game_Client/Classes/Game/Events/__pycache__/PlaceCard.cpython-311.pyc index f7eca6e..e9e0c43 100644 Binary files a/Game_Client/Classes/Game/Events/__pycache__/PlaceCard.cpython-311.pyc and b/Game_Client/Classes/Game/Events/__pycache__/PlaceCard.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc b/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc index 17a0ef4..72f14ce 100644 Binary files a/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc and b/Game_Client/Classes/Game/__pycache__/BoardField.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc b/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc index 81c3a64..5245928 100644 Binary files a/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc and b/Game_Client/Classes/Game/__pycache__/Player.cpython-311.pyc differ diff --git a/Game_Client/Classes/Game/__pycache__/World.cpython-311.pyc b/Game_Client/Classes/Game/__pycache__/World.cpython-311.pyc index 17d6e55..eb436c3 100644 Binary files a/Game_Client/Classes/Game/__pycache__/World.cpython-311.pyc and b/Game_Client/Classes/Game/__pycache__/World.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/App.py b/Game_Client/Classes/System/App.py index b51fbc3..92d62a0 100644 --- a/Game_Client/Classes/System/App.py +++ b/Game_Client/Classes/System/App.py @@ -47,12 +47,12 @@ class App: # create sprite groups # todo: remove these and let server handle card creation instead # blocker: server - client communication [WIP] - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(500, 1050), self.__inputHandler, Player(1000, 0, "test")) - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(600, 1050), self.__inputHandler, Player(1000, 0, "test")) - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(700, 1050), self.__inputHandler, Player(1000, 0, "test")) - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(800, 1050), self.__inputHandler, Player(1000, 0, "test")) - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(900, 1050), self.__inputHandler, Player(1000, 0, "test")) - self.__world.spawnCard("Assets/Cards/1", pygame.Vector2(1000, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(500, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(600, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(700, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(800, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(900, 1050), self.__inputHandler, Player(1000, 0, "test")) + self.__world.spawnCard("Assets/Cards/1/", pygame.Vector2(1000, 1050), self.__inputHandler, Player(1000, 0, "test")) while self.__running: self.__clock.tick(self.__FPS) @@ -79,7 +79,7 @@ class App: # handles incoming event queue def handleEvent(self, events): # TODO: fix bug that stacks cards when dragging them around - selectedCard = None + self.selectedCard = None for event in events: if event.type == pygame.QUIT: @@ -89,23 +89,22 @@ class App: mouse_pos = pygame.Vector2(mouse_x, mouse_y) for card in self.__world.getCards(): - if card.rect.collidepoint(mouse_pos) and selectedCard == None: - if card.getState() == "onHand": - card.setDragging(True) - selectedCard = card - for field in self.__world.getBoardFields(): - if field.getRect().collidepoint(mouse_pos): - if field.getSide() == "Player": - if field.getType() == "MonsterField" and card.getType() == "MonsterCard": - # todo: resize card so that it fits into the card field - card.rect.center = field.rect.center - field.image = card.image.copy() - card.setDragging(False) - elif field.getType() == "EffectField" and card.getType() == "EffectCard" or field.getType() == "EffectField" and card.getType() == "EffectCard": - # todo: resize card so that it fits into the card field - card.rect.center = field.rect.center - field.image = card.image.copy() - card.setDragging(False) + if card.rect.collidepoint(mouse_pos) and self.selectedCard == None: + card.setDragging(True) + self.selectedCard = card + for field in self.__world.getBoardFields(): + if field.getRect().collidepoint(mouse_pos): + if field.getSide() == "Player": + if field.getType() == "MonsterField" and card.getType() == "MonsterCard": + # todo: resize card so that it fits into the card field + card.rect.center = field.rect.center + field.image = card.image.copy() + card.setDragging(False) + elif field.getType() == "EffectField" and card.getType() == "EffectCard" or field.getType() == "EffectField" and card.getType() == "EffectCard": + # todo: resize card so that it fits into the card field + card.rect.center = field.rect.center + field.image = card.image.copy() + card.setDragging(False) elif self.__inputHandler.getPressed()[pygame.K_SPACE]: @@ -116,20 +115,19 @@ class App: mouse_pos = pygame.Vector2(mouse_x, mouse_y) if event.button == 1: # Wenn linke Maustaste losgelassen wird for card in self.__world.getCards(): + card.setDragging(False) # card.setState("placed") # TODO: send place card event to server # resets the currently selected card in order to prevent it getting moved try: - if card == selectedCard: - card.setDragging(False) - # TODO: send place card event to server - # resets the currently selected card in order to prevent it getting moved + print(self.selectedCard) + if self.selectedCard == card: PlaceCard(self.__tcpClient, card) # tells the server that the player placed this card except Exception as e: print(f"failed to place card on server due to error: {e}") - if not selectedCard == None: - selectedCard = None + if not card == None: + card = None # sets the running state for the gameloop def setRunning(self, running:bool): diff --git a/Game_Client/Classes/System/Components/__pycache__/InputHandler.cpython-311.pyc b/Game_Client/Classes/System/Components/__pycache__/InputHandler.cpython-311.pyc index 9b98f1c..10e97a1 100644 Binary files a/Game_Client/Classes/System/Components/__pycache__/InputHandler.cpython-311.pyc and b/Game_Client/Classes/System/Components/__pycache__/InputHandler.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc b/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc index f0331e9..507c282 100644 Binary files a/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc and b/Game_Client/Classes/System/Components/__pycache__/Label.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc b/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc index ef52463..1867184 100644 Binary files a/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc and b/Game_Client/Classes/System/Components/__pycache__/Window.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc b/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc index e60a3e6..3b0d395 100644 Binary files a/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc and b/Game_Client/Classes/System/Network/__pycache__/EventHandler.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc b/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc index 04c59e8..62eed0f 100644 Binary files a/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc and b/Game_Client/Classes/System/Network/__pycache__/TCPClient.cpython-311.pyc differ diff --git a/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc b/Game_Client/Classes/System/__pycache__/App.cpython-311.pyc index 81b1c68..c0c8d20 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