diff options
-rwxr-xr-x | misc/maze.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/misc/maze.py b/misc/maze.py index 8e192db..081e1c5 100755 --- a/misc/maze.py +++ b/misc/maze.py @@ -96,6 +96,14 @@ def MakeMaze(maze): yc+=3 return TRUEMAZE +def BuildLayer(LayerName, w, h, LayerData): + return(""" + <layer name="%s" width="%d" height="%d"> + <data encoding="csv"> +%s + </data> + </layer>""" % (LayerName, w, (h+1)*3, LayerData)) + # Begin print "Begin!" @@ -137,20 +145,14 @@ while MazeID < MaxMazes: """ % (width, (y+1)*3)) # Build set layer - f.write(""" - <layer name="set" width="%d" height="%d"> - <data encoding="csv"> -%s - </data> - </layer>""" % (width, (y+1)*3, MAZEDATA)) - - # Build heights layer - f.write(""" - <layer name="Heights" width="%d" height="%d"> - <data encoding="csv"> -%s - </data> - </layer>""" % (width, (y+1)*3, MAZEMPTY)) + f.write(BuildLayer("set", width, y, MAZEDATA)) + + # Build the other layers + f.write(BuildLayer("Ground", width, y, MAZEMPTY)) + f.write(BuildLayer("Fringe", width, y, MAZEMPTY)) + f.write(BuildLayer("Over", width, y, MAZEMPTY)) + f.write(BuildLayer("Collision", width, y, MAZEMPTY)) + f.write(BuildLayer("Heights", width, y, MAZEMPTY)) # Close the mapfile f.write(""" <objectgroup name="Objects"/> |