33# SPDX-License-Identifier: MIT
44import os
55import random
6+ import sys
67import time
78from io import BytesIO
89
@@ -133,7 +134,10 @@ class Match3Card(Group):
133134
134135 def __init__ (self , card_tuple , ** kwargs ):
135136 # tile palette mapper to color the card
136- self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 , 1 , 1 )
137+ if sys .implementation .version [0 ] == 9 :
138+ self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 , 1 , 1 )
139+ elif sys .implementation .version [0 ] >= 10 :
140+ self ._mapper = TilePaletteMapper (kwargs ["pixel_shader" ], 5 )
137141 kwargs ["pixel_shader" ] = self ._mapper
138142 # tile grid to for the visible sprite
139143 self ._tilegrid = TileGrid (** kwargs )
@@ -580,9 +584,11 @@ def handle_left_click(self, player_index, coords):
580584 # if 3 cards have been clicked
581585 if len (self .clicked_cards ) == 3 :
582586 # check if the 3 cards make a valid set
583- valid_set = validate_set (self .clicked_cards [0 ],
584- self .clicked_cards [1 ],
585- self .clicked_cards [2 ])
587+ valid_set = validate_set (
588+ self .clicked_cards [0 ],
589+ self .clicked_cards [1 ],
590+ self .clicked_cards [2 ],
591+ )
586592
587593 # if they are a valid set
588594 if valid_set :
@@ -660,7 +666,7 @@ def handle_left_click(self, player_index, coords):
660666 # load the game from the given game state
661667 self .load_from_game_state (self .game_state )
662668 # hide the title screen
663- self .title_screen .hidden = True # pylint: disable=attribute-defined-outside-init
669+ self .title_screen .hidden = True
664670 # set the current state to open play
665671 self .cur_state = STATE_PLAYING_OPEN
666672
@@ -676,7 +682,7 @@ def handle_left_click(self, player_index, coords):
676682 # initialize a new game
677683 self .init_new_game ()
678684 # hide the title screen
679- self .title_screen .hidden = True # pylint: disable=attribute-defined-outside-init
685+ self .title_screen .hidden = True
680686 # set the current state to open play
681687 self .cur_state = STATE_PLAYING_OPEN
682688
@@ -727,6 +733,7 @@ class Match3TitleScreen(Group):
727733
728734 def __init__ (self , display_size ):
729735 super ().__init__ ()
736+ self .hidden = False
730737 self .display_size = display_size
731738 # background bitmap color
732739 bg_bmp = Bitmap (display_size [0 ] // 10 , display_size [1 ] // 10 , 1 )
0 commit comments