добавил баланс мух, но не полностью
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ class Game:
|
|||||||
if event.type == pg.QUIT:
|
if event.type == pg.QUIT:
|
||||||
self.running = False
|
self.running = False
|
||||||
if event.type == pg.MOUSEBUTTONDOWN:
|
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.screen.fill((93, 101, 48))
|
||||||
self.swamp.render(self.screen)
|
self.swamp.render(self.screen)
|
||||||
pg.display.flip()
|
pg.display.flip()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import pygame as pg
|
|||||||
|
|
||||||
class RewardWindow:
|
class RewardWindow:
|
||||||
def open_window(self, event, screen):
|
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)
|
font = pg.font.Font(None, 30)
|
||||||
text_string = self.event_to_string(event)
|
text_string = self.event_to_string(event)
|
||||||
text = font.render(text_string, True, (255, 255, 255))
|
text = font.render(text_string, True, (255, 255, 255))
|
||||||
|
|||||||
+9
-3
@@ -49,6 +49,12 @@ class Swamp:
|
|||||||
pg.draw.rect(screen, (100, 100, 100),
|
pg.draw.rect(screen, (100, 100, 100),
|
||||||
(self.x, self.y, self.cell_size, self.cell_size), 1)
|
(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: # При нажатии на книгу рисуется небольшой экран с информацией
|
if self.book_use is True: # При нажатии на книгу рисуется небольшой экран с информацией
|
||||||
from modules.Mathematics import recalculation_events, get_random_event
|
from modules.Mathematics import recalculation_events, get_random_event
|
||||||
if not self.test:
|
if not self.test:
|
||||||
@@ -78,7 +84,7 @@ class Swamp:
|
|||||||
self.down_book = down
|
self.down_book = down
|
||||||
self.left_book = left
|
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_width = self.width * self.cell_size
|
||||||
board_height = self.height * self.cell_size
|
board_height = self.height * self.cell_size
|
||||||
if self.left_area < mouse_pos[0] < self.left_area + board_width:
|
if self.left_area < mouse_pos[0] < self.left_area + board_width:
|
||||||
@@ -98,6 +104,6 @@ class Swamp:
|
|||||||
def on_click(self, mouse_pos): # Действия после клика на клетчатое поле
|
def on_click(self, mouse_pos): # Действия после клика на клетчатое поле
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_click(self, mouse_pos, screen):
|
def get_click(self, mouse_pos):
|
||||||
cell = self.get_cell(mouse_pos, screen)
|
cell = self.get_cell(mouse_pos)
|
||||||
self.on_click(cell)
|
self.on_click(cell)
|
||||||
|
|||||||
Reference in New Issue
Block a user