Пример #1
0
 def parseLevel(self, level):
     tiles = []
     y = 0
     for li in level:
         x = 0
         temp = []
         for el in li:
             temp += [el]
             if el == "S":
                 Solid((x * 16, y * 16))
             elif el == "D":
                 d = DropBox((x * 16, y * 16))
                 d.x = y
                 d.y = x
             elif el == "G":
                 Gate((x * 16, y * 16))
             elif el == "C":
                 Coin((x * 16, y * 16))
             x += 1
         y += 1
         tiles += [temp]
     self.tiles = tiles
     # print 'rotating....'
     # self.printTiles()
     # self.rotateLeft()
     return self.tiles
Пример #2
0
 def parseMatrix(self, matrix):
     y = 0
     for li in matrix:
         x = 0
         temp = []
         for el in li:
             temp += [el]
             if el == "S":
                 Solid((x * 16, y * 16))
             elif el == "D":
                 db = DropBox((x * 16, y * 16))
                 db.x = y
                 db.y = x
             elif el == "G":
                 Gate((x * 16, y * 16))
             elif el == "C":
                 Coin((x * 16, y * 16))
             x += 1
         y += 1