-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGlobalData.py
59 lines (52 loc) · 1.81 KB
/
GlobalData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import string
import ImageData
import DisplayInfo
import pygame.time
#self.maps = self.getMaps()
def getMapData():
file1 = "data/Data.maps"
fileToLoad = open(file1, 'r')
mapData = dict()
for lines in fileToLoad:
tmpList = [x.strip() for x in lines.split(';')]
if tmpList[0][0] == "#":
continue
mapData[tmpList[0]] = tmpList[1:]
#print self.mapData[self.tmpList[0]]
#print self.mapData[self.tmpList[0]][len(self.mapData[self.tmpList[0]])-1]
#mapData[tmpList[0]][len(mapData[tmpList[0]])-1] #does this do anything??? Doesn't appear so....
fileToLoad.close()
return mapData
def getStats():
file1 = "data/BaseStats.stats"
fileToLoad = open(file1, 'r')
statData = dict()
for lines in fileToLoad:
tmpList = [x.strip() for x in lines.split(';')]
if tmpList[0][0] == "#":
continue
statData[tmpList[0]] = tmpList[1:]
statData[tmpList[0]][len(tmpList[1:])-1] = statData[tmpList[0]][len(tmpList[1:])-1][:-1]
fileToLoad.close()
return statData
def getItemData():
file1 = "data/Items.data"
fileToLoad = open(file1, 'r')
itemData = dict()
for lines in fileToLoad:
tmpList = [x.strip() for x in lines.split(';')]
if tmpList[0][0] == "#":
continue
itemData[tmpList[0]] = tmpList[1:]
itemData[tmpList[0]][len(tmpList[1:])-1] = itemData[tmpList[0]][len(tmpList[1:])-1][:-1]
fileToLoad.close()
return itemData
statsData = getStats()
mapsData = getMapData()
itemData = getItemData()
quitFlag = 0
textureManager = ImageData.ImageData()
displayInitialized = 0
display = DisplayInfo.DisplayInfo()
timer = pygame.time.Clock()
debugMode = False