Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def parseLevel(filename):
- m = walls = tots = []
- fileObj = open(filename)
- st = fileObj.read()
- fileObj.close()
- rez = st.find(".", 0)
- tot = [float(res[0]) / float(st[0: rez]), float(res[1]) / float(st[0:rez])]
- x = st.find(".", rez + 1)
- y = st.find("(", x)
- h = 0
- for i in range(0, int(st[rez + 1:x])):
- walls.append([])
- for e in range(0, int(st[x + 1:y])):
- h, h2 = st.find("(", h) + 1, st.find(")", h)
- for la in range(0, 5):
- go = st.find(",", h, h2)
- m.append(int(st[h:go]))
- h = go + 1
- if m[4] == 2:
- m[4] = 0
- player.rect = pygame.Rect(m[0] * tot[0], m[1] * tot[1], m[2] * tot[0], m[3] * tot[1])
- walls[i].append(Wall((m[0] * tot[0], m[1] * tot[1], m[2] * tot[0], m[3] * tot[1], m[4])))
- m = []
- return (tot, walls)
- this worked when it went
- m = walls = tots = []
- def parseLevel(filename):
Add Comment
Please, Sign In to add comment