From 2775ca1277f34a573c56f4a65d94b1df537ae3bd Mon Sep 17 00:00:00 2001 From: matixezor Date: Tue, 16 Mar 2021 20:15:48 +0100 Subject: [PATCH] add getting dir path from os --- src/const.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/const.py b/src/const.py index 3d675bd..041c3b4 100644 --- a/src/const.py +++ b/src/const.py @@ -1,35 +1,36 @@ +import os from pygame import image -from config import main_path +main_path = os.path.dirname(os.getcwd()) WIDTH = 800 HEIGHT = 800 IMAGES = [] -for img in ['grass_01', 'grass_02', 'grass_mine_01', 'grass_mine_02', 'grass_rock_01','grass_mine_02a','grass_mine_02a', - 'grass_mine_02b','grass_mine_03a','grass_rock_02']: - IMAGES.append(image.load(main_path + 'images/Tiles/' + img + ".png")) +for img in [ + 'grass_01', + 'grass_02', + 'grass_mine_01', + 'grass_mine_02', + 'grass_mine_02a', + 'grass_mine_02a', + 'grass_mine_02b', + 'grass_mine_03a', + 'grass_rock_01', + 'grass_rock_02', +]: + IMAGES.append(image.load(main_path + '/images/Tiles/' + img + ".png")) -ICON = main_path + 'images/mine_icon.png' -SAPPER_IDLE = image.load(main_path + 'images/sapper_idle/cpt_bomba.png') +ICON = main_path + '/images/mine_icon.png' +SAPPER_IDLE = image.load(main_path + '/images/sapper_idle/cpt_bomba.png') SAPPER_RUNNING = [] -"""for img in [ - 'sapper_run_01', - 'sapper_run_02', - 'sapper_run_03', - 'sapper_run_04', - 'sapper_run_05', - 'sapper_run_06', - 'sapper_run_07', - 'sapper_run_08', -]:""" for img in [ 'cpt_bomba_left', 'cpt_bomba_right', ]: - SAPPER_RUNNING.append(image.load(main_path + 'images/sapper_idle/' + img + ".png")) + SAPPER_RUNNING.append(image.load(main_path + '/images/sapper_idle/' + img + ".png")) DEFAULT_FIELD = [ [1, 3, 4, 5, 0, 1, 2, 3, 2, 0],