From 2d563a35082595324ee73309ab5ac8d9901548b9 Mon Sep 17 00:00:00 2001 From: En Yi Date: Wed, 12 Jun 2019 19:26:30 +0100 Subject: [PATCH] Fix mouse click and invalid card select --- players.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/players.py b/players.py index eae53a2..500ce8c 100644 --- a/players.py +++ b/players.py @@ -198,7 +198,7 @@ class MainPlayer(Player): if game_events: for event in game_events: mouse_clicks = event.type == pygame.MOUSEBUTTONDOWN - if self.left_mouse_down and not mouse_clicks: + if event.type == pygame.MOUSEBUTTONUP and event.button == 1: print('mouse click') mouse_pos = pygame.mouse.get_pos() if self.rect.collidepoint(mouse_pos): @@ -213,6 +213,8 @@ class MainPlayer(Player): card_value = self.cards[self.selected_card].value if self.check_for_valid_plays(card_value, substate == 0): card = self.remove_selected_card() + else: + card = 1 self.deselect_card() self.double_clicking = False else: @@ -227,8 +229,6 @@ class MainPlayer(Player): self.double_clicking = False print('double click disabled') - self.left_mouse_down = mouse_clicks - return card