XemiTicTac wrote: ↑Thu Nov 07, 2019 8:30 am
... i want make the cards to appear in a specific area of the screen. ...
Well, for now all the cards are placed in a grid, so you can set the position of the grid, like
Code: Select all
grid 3 4:
align (0.5, 0.5)
for card in cards_list:
or apply the transform to it -
viewtopic.php?f=8&t=55947&p=514658#p514658
The other way would be to add individual positions for each card in their description and show them not in a grid but at their positions, like
Code: Select all
label memoria_game:
#####
#
# At first, let's set the cards to play (the amount should match the grid size - in this example 12)
$ values_list = ["A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B"]
# Then - shuffle them
$ values_list = cards_shuffle(values_list)
# And make the cards_list that describes all the cards
$ cards_list = []
$ card_positions_list = [(100, 50), (150, 70), (70, 150), (120, 90)] #the number of positions must match the number of cards !!!
python:
for i in range (0, len(values_list) ):
cards_list.append ( {"c_number":i, "c_value": values_list[i], "c_chosen":False, "c_pos":card_positions_list[i]} )
Code: Select all
#grid 3 4:
for card in cards_list:
button:
pos card["c_pos"]
background None