-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chunkloader2.py
48 lines (35 loc) · 1.37 KB
/
Chunkloader2.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
import ast
class Chunk(object):
def __init__(self,Screenwidth, Screenheight):
#Standartauflösung 1024x576
#StandartAssetgröße 32x32
#Standart Assets in Breite 32
#Standart Assets in Höhe 18
self.screenwith = Screenwidth
self.screenheight = Screenheight
self.name = "Chunk"
self.actual_Chunk = []
self.realactual_chunk=[]
self.realactual_chunk2 =[]
self.Assetwidth = 32
self.Assetheight = 32
self.Assetheightscal = 0
self.Assetwidthscal = 0
self.calculate_Assetnumbers()
self.geladener_chunk_x = -2
self.geladener_chunk_y = -2
def calculate_Assetnumbers(self):
self.Assetwidth = self.screenwith/32
self.Assetheight = self.screenheight/18
self.Assetheightscal = self.Assetheight - 32
self.Assetwidthscal = self.Assetwidth - 32
def load_chunk(self,x,y):
if self.geladener_chunk_x != x or self.geladener_chunk_y != y:
Chunkname = "Chunks/chunk"+str(x)+"_"+str(y)+".txt"
#print(Chunkname)
self.actual_Chunk = open(Chunkname).read()
self.actual_Chunk = ast.literal_eval(self.actual_Chunk)
#for a in self.actual_Chunk:
#print(a)
#print(self.actual_Chunk)
return(self.actual_Chunk)