Fix mouse click and invalid card select

master
En Yi 2019-06-12 19:26:30 +01:00
parent ba88887a72
commit 2d563a3508
1 changed files with 3 additions and 3 deletions

View File

@ -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