|
1 |
| -import sys |
2 |
| -import subprocess |
3 |
| -import paths |
| 1 | +""" |
| 2 | +A file to export constants used throughout the application. |
| 3 | +
|
| 4 | +This module exports: |
| 5 | + VERSION - The game version of the current code. |
| 6 | + DISPLAY_NAME - The window title. |
| 7 | + DISPLAY_SIZE - The fixed size of the display. |
| 8 | +
|
| 9 | + MAP_SIZE - The x by y size of the game maps, in tiles. |
| 10 | + TILE_WIDTH - The width of game tiles in px. |
| 11 | + TILE_HEIGHT - The height of game tiles in px. |
| 12 | +
|
| 13 | + MAP_WIDTH - The total map width, worked out from the MAP_SIZE and TILE_WIDTH. |
| 14 | + MAP_HEIGHT - The total map height, worked out from the MAP_SIZE and TILE_WIDTH. |
| 15 | + MAP_PADDING - An arbitrary value for padding around the map. |
| 16 | +
|
| 17 | + GAME_RECT - The rect value ([x, y, width, height]) of the map, including padding. |
| 18 | + ORIGIN - The exact top point of the isometric map. |
| 19 | +
|
| 20 | + COLOURS - A dictionary of colours used throughout the application. |
| 21 | + FONTS - A dictionary of font information used in teh application. |
4 | 22 |
|
5 |
| -# Dev Version Text (Tries for git version, if cant get it, revert to version saved here) |
6 |
| -try: |
7 |
| - if sys.version_info[0] < 3.5: |
8 |
| - version = subprocess.check_output(["git", "describe", "--tags"]).strip() |
9 |
| - else: |
10 |
| - version = subprocess.run(["git", "describe", "--tags"], stdout=subprocess.PIPE).stdout.decode("utf-8") |
11 |
| - assert version != "" |
12 |
| -except Exception: # seems to be so dependent on system and versions, easier to do a catch all |
13 |
| - version = "v1.1.1" # git not installed, or older lib version, so revert to hardcoded version |
| 23 | + UNIT_SPECS - The data for each unit in the game including health, attach, defense etc. |
| 24 | + LEVELS - A matrix that manages how city level increases work. |
| 25 | +""" |
14 | 26 |
|
| 27 | +import paths |
| 28 | + |
| 29 | +# Application version. Should always match repository tag. |
| 30 | +VERSION = "v1.1.1" |
15 | 31 |
|
16 | 32 | # configuration for pygame.display
|
17 | 33 | DISPLAY_NAME = "Conqueror of Empires"
|
|
27 | 43 | MAP_HEIGHT = TILE_HEIGHT*MAP_SIZE[1]
|
28 | 44 | MAP_PADDING = 20 # space between map and edge of game surface.
|
29 | 45 |
|
30 |
| -width = MAP_WIDTH + MAP_PADDING*2 |
31 |
| -height = MAP_HEIGHT + TILE_HEIGHT + MAP_PADDING*2 |
32 |
| -x = -MAP_WIDTH/2 |
33 |
| -y = -MAP_PADDING |
34 |
| -GAME_RECT = [x, y, width, height] # x, y change with scroll anyway |
| 46 | +WIDTH = MAP_WIDTH + MAP_PADDING * 2 |
| 47 | +HEIGHT = MAP_HEIGHT + TILE_HEIGHT + MAP_PADDING * 2 |
| 48 | +X = -MAP_WIDTH / 2 |
| 49 | +Y = -MAP_PADDING |
| 50 | +GAME_RECT = [X, Y, WIDTH, HEIGHT] # x, y change with scroll anyway |
35 | 51 |
|
36 | 52 | ORIGIN = [GAME_RECT[2]/2 - TILE_HEIGHT + MAP_PADDING, MAP_PADDING] # top map point
|
37 | 53 |
|
|
59 | 75 | "small": 12},
|
60 | 76 | "colour": COLOURS["white"]}
|
61 | 77 |
|
62 |
| -# Game Data |
63 |
| -TILE_DATA = { |
64 |
| - "s": [0, 0, 0], |
65 |
| - "w": [0, 0, 0], |
66 |
| - "g": [0, 0, 0], |
67 |
| - "f": [100, 20, 5], |
68 |
| - "m": [10, 100, 20], |
69 |
| - "o": [10, 100, 50], |
70 |
| - "c": [100, 50, 25], # default of settlement store (level 1) |
71 |
| -} |
72 |
| - |
73 |
| - |
74 | 78 | UNIT_SPECS = {
|
75 | 79 | "scout": {
|
76 | 80 | "max_health": 10,
|
|
124 | 128 | },
|
125 | 129 | }
|
126 | 130 |
|
127 |
| -# each item is level, each item in level is sub-level. |
128 |
| -# item: len() = number of sub-levels to next level, value is ap cost to reach sub level/ len() = 0 means max level |
129 |
| -# city level starts at 1, to reference level must do city_level - 1. |
| 131 | +# Levels Matrix |
| 132 | +# each list item represents a level, each item within a level list represents a sub-level. |
130 | 133 | LEVELS = [
|
131 | 134 | [2, 2, 2], # 1 to 2
|
132 | 135 | [2, 2, 2, 2], # 2 to 3
|
|
135 | 138 | [], # 5 is max
|
136 | 139 | ]
|
137 | 140 |
|
138 |
| - |
139 | 141 | # Cleanup unneeded to not pollute namespace.
|
140 |
| -del x, y, width, height, MAP_PADDING |
| 142 | +del X, Y, WIDTH, HEIGHT, MAP_PADDING |
0 commit comments