@@ -14,34 +14,35 @@ def __init__(self, x, y, chosen_y, width, collide_point, display, surface):
14
14
def draw_deck (self , move_from_shuffle = False , game_update = False ):
15
15
if not move_from_shuffle :
16
16
self .surface .blit (self .background , (self .x , self .y ))
17
+ self .surface .blit (self .half_background , (self .x , self .chosen_y ))
17
18
18
19
num_cards = len (self .deck )
19
20
starting = max ((self .width + self .x ) - (num_cards * self .card_width ), self .x )
20
21
21
22
if num_cards == 0 or num_cards == 1 :
22
- card_pos = self .card_width
23
+ self . card_pos = self .card_width
23
24
else :
24
- card_pos = min (self .card_width ,
25
- round ((self .width - self .card_width ) / (num_cards - 1 )))
25
+ self . card_pos = min (self .card_width ,
26
+ round ((self .width - self .card_width ) / (num_cards - 1 )))
26
27
27
28
update_rect (self .collide_point , self .x , self .y ,
28
29
min ((num_cards * self .card_width ), self .width ), self .card_height )
29
30
30
31
for i in range (len (self .deck )):
31
- self .surface .blit (self .full_card , (starting + card_pos , self .y ))
32
+ self .surface .blit (self .full_card , (starting + self . card_pos , self .y ))
32
33
33
34
x = self .deck [i ]
34
35
35
36
if not x .get_chosen ():
36
37
# We draw the background, then draw the previous cards, then proceed.
37
38
if self .was_chosen_deck .__contains__ (x ):
38
- width = self .get_cover_width (i , card_pos , for_chosen = False )
39
+ width = self .get_cover_width (i , for_chosen = False )
39
40
self .half_card = pygame .Surface ((width , self .card_height / 2 ))
40
41
self .half_card .fill (self .settings .bg_color )
41
42
self .surface .blit (self .half_card , (starting + self .card_width - width , self .chosen_y ))
42
43
self .was_chosen_deck .remove (x )
43
44
44
- self .draw_previous (i , card_pos )
45
+ self .draw_previous (i )
45
46
46
47
self .draw_rest_deck (x )
47
48
x .update_vis (True )
@@ -53,25 +54,25 @@ def draw_deck(self, move_from_shuffle=False, game_update=False):
53
54
54
55
if i != len (self .deck ) - 1 :
55
56
if not self .deck [i + 1 ].get_chosen ():
56
- x .update_card_block_area (starting + card_pos , self .y ,
57
- self .card_width - card_pos , self .card_height )
57
+ x .update_card_block_area (starting + self . card_pos , self .y ,
58
+ self .card_width - self . card_pos , self .card_height )
58
59
else :
59
- x .update_card_block_area (starting + card_pos , self .y ,
60
- self .card_width - card_pos , self .card_height / 2 )
60
+ x .update_card_block_area (starting + self . card_pos , self .y ,
61
+ self .card_width - self . card_pos , self .card_height / 2 )
61
62
else :
62
- x .update_card_block_area (starting + card_pos , self .y , 0 , 0 )
63
+ x .update_card_block_area (starting + self . card_pos , self .y , 0 , 0 )
63
64
64
65
# Do this portion
65
66
else :
66
67
if self .to_be_chosen_cards .__contains__ (x ):
67
- width = self .get_cover_width (i , card_pos , for_chosen = True )
68
+ width = self .get_cover_width (i , for_chosen = True )
68
69
self .half_card = pygame .Surface ((width , self .card_height / 2 ))
69
70
self .half_card .fill (self .settings .bg_color )
70
71
self .surface .blit (self .half_card ,
71
72
(starting + self .card_width - width , self .y + self .card_height / 2 ))
72
73
self .to_be_chosen_cards .remove (x )
73
74
74
- self .draw_previous (i , card_pos )
75
+ self .draw_previous (i )
75
76
76
77
self .draw_rest_deck (x )
77
78
@@ -81,19 +82,19 @@ def draw_deck(self, move_from_shuffle=False, game_update=False):
81
82
82
83
if i != len (self .deck ) - 1 :
83
84
if not self .deck [i + 1 ].get_chosen ():
84
- x .update_card_block_area (original_x + card_pos ,
85
+ x .update_card_block_area (original_x + self . card_pos ,
85
86
self .y ,
86
- self .card_width - card_pos ,
87
+ self .card_width - self . card_pos ,
87
88
self .y - self .chosen_y )
88
89
else :
89
- x .update_card_block_area (original_x + card_pos ,
90
+ x .update_card_block_area (original_x + self . card_pos ,
90
91
self .chosen_y ,
91
- self .card_width - card_pos ,
92
+ self .card_width - self . card_pos ,
92
93
self .card_height )
93
94
else :
94
- x .update_card_block_area (original_x + card_pos , self .y , 0 , 0 )
95
+ x .update_card_block_area (original_x + self . card_pos , self .y , 0 , 0 )
95
96
96
- starting += card_pos
97
+ starting += self . card_pos
97
98
if self .was_drag_card .__contains__ (x ):
98
99
self .was_drag_card .remove (x )
99
100
@@ -114,6 +115,7 @@ def handle_selected(self, mouse_x, mouse_y, dragging):
114
115
115
116
self .surface .blit (self .full_card , (card .cur_pos ()))
116
117
118
+ self .draw_previous (i )
117
119
self .draw_rest_deck (self .deck [max (i - 1 , 0 )], for_drag = True )
118
120
self .update (False )
119
121
0 commit comments