From 3a6dce01c625064fd2afdfb3646d87a3e1ed0332 Mon Sep 17 00:00:00 2001 From: wzc <2747604107@qq.com> Date: Tue, 28 May 2024 17:15:27 +0800 Subject: [PATCH] first commit --- config.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..ac136d5 --- /dev/null +++ b/config.py @@ -0,0 +1,87 @@ +import os + +'''字体''' +FONTPATH = os.path.join(os.getcwd(), 'resources/font/consola.ttf') +'''图片''' +BULLET_IMAGE_PATHS = { + (0, -1): os.path.join(os.getcwd(), 'resources/images/bullet/bullet_up.png'), + (0, 1): os.path.join(os.getcwd(), 'resources/images/bullet/bullet_down.png'), + (-1, 0): os.path.join(os.getcwd(), 'resources/images/bullet/bullet_left.png'), + (1, 0): os.path.join(os.getcwd(), 'resources/images/bullet/bullet_right.png') +} +ENEMY_TANK_IMAGE_PATHS = { + '0': [os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_1_0.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_1_1.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_1_2.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_1_3.png')], + '1': [os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_2_0.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_2_1.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_2_2.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_2_3.png')], + '2': [os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_3_0.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_3_1.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_3_2.png'), + os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_3_3.png')], + # '3': [os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_4_0.png'), + # os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_4_1.png'), + # os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_4_2.png'), + # os.path.join(os.getcwd(), 'resources/images/enemyTank/enemy_4_3.png')] +} +PLAYER_TANK_IMAGE_PATHS = { + 'player1': [os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T1_0.png'), + os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T1_1.png'), + os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T1_2.png')], + 'player2': [os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T2_0.png'), + os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T2_1.png'), + os.path.join(os.getcwd(), 'resources/images/playerTank/tank_T2_2.png')] +} +FOOD_IMAGE_PATHS = { + 'boom': os.path.join(os.getcwd(), 'resources/images/food/food_boom.png'), + 'clock': os.path.join(os.getcwd(), 'resources/images/food/food_clock.png'), + 'gun': os.path.join(os.getcwd(), 'resources/images/food/food_gun.png'), + 'iron': os.path.join(os.getcwd(), 'resources/images/food/food_iron.png'), + 'protect': os.path.join(os.getcwd(), 'resources/images/food/food_protect.png'), + 'star': os.path.join(os.getcwd(), 'resources/images/food/food_star.png'), + 'tank': os.path.join(os.getcwd(), 'resources/images/food/food_tank.png') +} +HOME_IMAGE_PATHS = [os.path.join(os.getcwd(), 'resources/images/home/home1.png'), + os.path.join(os.getcwd(), 'resources/images/home/home_destroyed.png')] +SCENE_IMAGE_PATHS = { + 'brick': os.path.join(os.getcwd(), 'resources/images/scene/brick.png'), + 'ice': os.path.join(os.getcwd(), 'resources/images/scene/ice.png'), + 'iron': os.path.join(os.getcwd(), 'resources/images/scene/iron.png'), + 'river1': os.path.join(os.getcwd(), 'resources/images/scene/river1.png'), + 'river2': os.path.join(os.getcwd(), 'resources/images/scene/river2.png'), + 'tree': os.path.join(os.getcwd(), 'resources/images/scene/tree.png') +} +OTHER_IMAGE_PATHS = { + 'appear': os.path.join(os.getcwd(), 'resources/images/others/appear.png'), + 'background': os.path.join(os.getcwd(), 'resources/images/others/background.png'), + 'boom_dynamic': os.path.join(os.getcwd(), 'resources/images/others/boom_dynamic.png'), + 'boom_static': os.path.join(os.getcwd(), 'resources/images/others/boom_static.png'), + 'gameover': os.path.join(os.getcwd(), 'resources/images/others/gameover.png'), + 'logo': os.path.join(os.getcwd(), 'resources/images/others/logo.png'), + 'mask': os.path.join(os.getcwd(), 'resources/images/others/mask.png'), + 'protect': os.path.join(os.getcwd(), 'resources/images/others/protect.png'), + 'tip': os.path.join(os.getcwd(), 'resources/images/others/tip.png'), + 'loadbar': os.path.join(os.getcwd(), 'resources/images/others/gamebar.png') +} +'''声音''' +AUDIO_PATHS = { + 'add': os.path.join(os.getcwd(), 'resources/audios/add.wav'), + 'bang': os.path.join(os.getcwd(), 'resources/audios/bang.wav'), + 'blast': os.path.join(os.getcwd(), 'resources/audios/blast.wav'), + 'fire': os.path.join(os.getcwd(), 'resources/audios/fire.wav'), + 'Gunfire': os.path.join(os.getcwd(), 'resources/audios/Gunfire.wav'), + 'hit': os.path.join(os.getcwd(), 'resources/audios/hit.wav'), + 'start': os.path.join(os.getcwd(), 'resources/audios/start.wav') +} +'''屏幕''' +WIDTH = 630 +HEIGHT = 630 +BORDER_LEN = 3 +GRID_SIZE = 24 +PANEL_WIDTH = 170 +TITLE = '坦克大战 21412030213 计科2102班 伍志诚' +'''关卡''' +LEVELFILEDIR = os.path.join(os.getcwd(), 'modules/levels')