From bf0760588cb1cf1373ea9194401e949fb2a9672f Mon Sep 17 00:00:00 2001 From: s452645 Date: Fri, 12 Mar 2021 09:55:59 +0100 Subject: [PATCH] minor main and constants refactors --- main.py | 5 ++++- project_constants.py | 28 +++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 5ec51d6..9e7d0b1 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ import event_interpreter -if __name__ == "__main__": +def main(): pygame.init() @@ -62,3 +62,6 @@ if __name__ == "__main__": running = False else: event_interpreter.interpret( event ) + +if __name__ == "__main__": + main() diff --git a/project_constants.py b/project_constants.py index c2af97c..14ef04e 100644 --- a/project_constants.py +++ b/project_constants.py @@ -17,6 +17,8 @@ V_NAME_OF_WINDOW = "MineFusion TM" V_TILE_SIZE = 60 V_GRID_VER_TILES = V_GRID_HOR_TILES = 10 # vertical, horizontal V_SCREEN_PADDING = 10 +V_MINEFIELD_HEIGHT = V_TILE_SIZE * V_GRID_VER_TILES +V_MINEFIELD_WIDTH = V_TILE_SIZE * V_GRID_HOR_TILES SCREEN = pygame.display.set_mode\ ( @@ -35,77 +37,77 @@ SCREEN = pygame.display.set_mode\ ASSET_BACKGROUND = pygame.transform.scale\ ( pygame.image.load('resources/assets/new_grid.png'), - ( 600, 600 ) + (V_MINEFIELD_WIDTH, V_MINEFIELD_WIDTH) ) ASSET_SAPPER = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/sapper.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_MINE_A = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/mine_a.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_MINE_B = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/mine_b.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_MINE_F = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/mine_f.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_MINE_K = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/mine_k.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_ORANGE = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_orange.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_RED = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_red.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_BLUE = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_blue.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_PURPLE = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_purple.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_GREEN = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_green.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_YELLOW = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_yellow.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) ASSET_TILE_WHITE = pygame.transform.scale\ ( pygame.image.load( 'resources/assets/tile_white.png' ), - ( 60, 60 ) + (V_TILE_SIZE, V_TILE_SIZE) ) \ No newline at end of file