diff --git a/main.py b/main.py index 5dfadf1..44b97cd 100644 --- a/main.py +++ b/main.py @@ -113,7 +113,7 @@ while run: elif mouse_down == "right" and time() - r_click_time >= r_click_cd: r_click_time = domino.update_rotation(mouse_new_pos[0], mouse_new_pos[1], r_click_time) - # если мы кликнули на кнопку, добовляем в руку новые домино + # если мы кликнули на кнопку, добaвляем в руку новые домино if not move and mouse_down == "left": values = False @@ -193,6 +193,6 @@ while run: screen.blit(surf, rect) - screen.blit(text,(s.SCREEN_WIDTH/2, s.SCREEN_HEIGHT/2)) + screen.blit(text,(s.SCREEN_WIDTH/2 - 250, s.SCREEN_HEIGHT/2 - 100)) pygame.display.flip() diff --git a/screens.py b/screens.py index 776146d..9a88b23 100644 --- a/screens.py +++ b/screens.py @@ -50,13 +50,15 @@ class Button(pygame.sprite.Sprite): def active_button(self, mouse_x, mouse_y, r_click_time, dominos): # если нажали на кнопку, добавляем домино в руку + values = False if self.rect.x <= mouse_x <= self.rect.x + self.w and self.rect.y <= mouse_y <= self.rect.y + self.h: # pygame.transform.rotate(self.surf, 90) x = 110 * len(dominos) - 1 y = s.SCREEN_HEIGHT - s.DOMINO_H / 2 - 25 - values = choice(s.DOMINOS) - # domino = Domino(x, y, values, len(dominos) - 1) - s.DOMINOS.remove(values) + if len(s.DOMINOS) > 0: + values = choice(s.DOMINOS) + # domino = Domino(x, y, values, len(dominos) - 1) + s.DOMINOS.remove(values) return time(), values, [x, y] return r_click_time, False, False diff --git a/settings.py b/settings.py index 3a80e10..d902db3 100644 --- a/settings.py +++ b/settings.py @@ -8,14 +8,14 @@ DOMINO_H = 200 DOMINOS = [] -values = range(7) -for v_up in values: - for v_down in values: - if not [v_up, v_down] in DOMINOS and not [v_down, v_up] in DOMINOS: - DOMINOS.append([v_up, v_down]) +# values = range(7) +# for v_up in values: +# for v_down in values: +# if not [v_up, v_down] in DOMINOS and not [v_down, v_up] in DOMINOS: +# DOMINOS.append([v_up, v_down]) -# for _ in range(10): -# DOMINOS.append([[1, '1'], [1, '1']]) +for _ in range(10): + DOMINOS.append([[1, '1'], [1, '1']]) # print(DOMINOS) @@ -29,14 +29,14 @@ str_values = { 5: ["10/2", "25^0.5", "2*5/2", "4!-19", "True*10/2", "3+2", "100/20", "4*1.25", "int(5.839)", "5+5-5+5-5", "2.5*2"], 6: ["3!", "2+2*2", "round(pi)*2", "(if 6>1)*6", "10-4", "24/4", "sqrt(12*3)", "3^2-3", "2*(4-1)", "{1,3,6}[2]"] } - -for i in range(len(DOMINOS)): - v_up = choice(str_values[DOMINOS[i][0]]) - str_values[DOMINOS[i][0]].remove(v_up) - v_down = choice(str_values[DOMINOS[i][1]]) - str_values[DOMINOS[i][1]].remove(v_down) - - DOMINOS[i] = [[DOMINOS[i][0], v_up], [DOMINOS[i][1], v_down]] +# +# for i in range(len(DOMINOS)): +# v_up = choice(str_values[DOMINOS[i][0]]) +# str_values[DOMINOS[i][0]].remove(v_up) +# v_down = choice(str_values[DOMINOS[i][1]]) +# str_values[DOMINOS[i][1]].remove(v_down) +# +# DOMINOS[i] = [[DOMINOS[i][0], v_up], [DOMINOS[i][1], v_down]] # print(DOMINOS)