добавил баланс мух, но не полностью

This commit is contained in:
2023-01-23 17:04:56 +07:00
parent af27d3393f
commit e0470cf5a5
4 changed files with 12 additions and 6 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ class Game:
if event.type == pg.QUIT:
self.running = False
if event.type == pg.MOUSEBUTTONDOWN:
self.swamp.get_click(event.pos, self.screen)
self.swamp.get_click(event.pos)
self.screen.fill((93, 101, 48))
self.swamp.render(self.screen)
pg.display.flip()
+1 -1
View File
@@ -3,7 +3,7 @@ import pygame as pg
class RewardWindow:
def open_window(self, event, screen):
pg.draw.rect(screen, (38, 33, 55), (0, 0, 700, 500))
pg.draw.rect(screen, (38, 33, 55), (0, 100, 700, 400))
font = pg.font.Font(None, 30)
text_string = self.event_to_string(event)
text = font.render(text_string, True, (255, 255, 255))
+9 -3
View File
@@ -49,6 +49,12 @@ class Swamp:
pg.draw.rect(screen, (100, 100, 100),
(self.x, self.y, self.cell_size, self.cell_size), 1)
font = pg.font.Font(None, 50)
text_string = "Ваш баланс мух составляет: 1000"
text = font.render(text_string, True, (255, 255, 255))
size = font.size(text_string)
screen.blit(text, (350 - (size[0] / 2.), 50))
if self.book_use is True: # При нажатии на книгу рисуется небольшой экран с информацией
from modules.Mathematics import recalculation_events, get_random_event
if not self.test:
@@ -78,7 +84,7 @@ class Swamp:
self.down_book = down
self.left_book = left
def get_cell(self, mouse_pos, screen):
def get_cell(self, mouse_pos):
board_width = self.width * self.cell_size
board_height = self.height * self.cell_size
if self.left_area < mouse_pos[0] < self.left_area + board_width:
@@ -98,6 +104,6 @@ class Swamp:
def on_click(self, mouse_pos): # Действия после клика на клетчатое поле
pass
def get_click(self, mouse_pos, screen):
cell = self.get_cell(mouse_pos, screen)
def get_click(self, mouse_pos):
cell = self.get_cell(mouse_pos)
self.on_click(cell)