Trying to make card matching game
I have explored the game examples
I have created a 7x4 grid of paired cards ♥️ and two jokers
Now I want switch the images to card backs so that selecting a card will show the card
No matter what I try I have found no way to change the image of a specific card.
I tried covering the cards with back sprites with intention of changing the z-position of the hidden card, and could not find a way to do that either.
Clearly I am not getting Sprites, and the documentation has not enlightened me..
This is my new game code
def new_game(self):
self.root_node.run_action(A.sequence(A.fade_to(0, 0.35), A.remove()))
self.score = 0
self.score_label.text = '0'
self.start_time = self.t
self.root_node = Node(parent=self, position=self.size/2)
self.root_node.scale = 0
self.gamecards = []
self.gamecards = cardimages
self.tiles = []
# Populate board with the 28 cards in gamecards
for y, x in product(range(ROWS), range(COLS)):
img_name = self.gamecards.pop ()
s = Tile(img_name, x, y) # s tuple "array' created to hold cards?
# {{Post Solution Note: This was where I went wrong, I was seeing the cards I had created as an array,
# and I assumed could address them as such}}
self.root_node.add_child(s)
self.tiles.append(s)
self.root_node.run_action(A.scale_to(SCALE, 4, TIMING_EASE_OUT_2)) # This sets the board up and zooms out
sound.play_effect('digital:ZapThreeToneUp')
# Need to cover with back of card images
Any hints would be greatly appreciated.