diff options
author | Treeki <treeki@gmail.com> | 2011-12-08 01:50:52 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-12-08 01:50:52 +0100 |
commit | c1cd2955c3e9b1dbb7ea72c85f996a19ab37ea3b (patch) | |
tree | 178588c02814c217ca50a5e7a2a49fc55d3219b9 /src/mapdata.py | |
parent | 21cf889b5e45a5619a09e46db246abd4abbec3a4 (diff) | |
download | koopatlas-c1cd2955c3e9b1dbb7ea72c85f996a19ab37ea3b.tar.gz koopatlas-c1cd2955c3e9b1dbb7ea72c85f996a19ab37ea3b.zip |
the first version of map exporting
Diffstat (limited to '')
-rw-r--r-- | src/mapdata.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mapdata.py b/src/mapdata.py index ec0feff..23c6b83 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -1,7 +1,6 @@ from common import * import weakref import mapfile -import base64 TILE_SIZE = (24,24) MAP_SIZE_IN_TILES = (512,512) @@ -250,7 +249,7 @@ class KPNodeAction(object): @mapfile.dumpable('node') class KPNode(object): __dump_attribs__ = ( - 'position', 'actions', 'level', 'isStop', 'mapChange', + 'position', 'actions', 'level', 'mapChange', 'transition', 'mapID', 'foreignID') def _dump(self, mapObj, dest): @@ -265,12 +264,15 @@ class KPNode(object): self.position = (0,0) self.actions = [] self.exits = [] - self.level = [0,0] - self.isStop = False + self.level = None self.mapChange = None self.transition = 0 self.mapID = None self.foreignID = None + + def isStop(self): + return True if (self.level or self.mapChange or len(self.exits) != 2) else False + @mapfile.dumpable('path') @@ -304,7 +306,7 @@ class KPPath(object): self.secret = 0 # 0 = unlocks from normal exit, 1 = unlocks from secret exit if cloneFrom is None: - self.animation = None + self.animation = 0 else: self.animation = cloneFrom.animation @@ -388,6 +390,12 @@ class KPMap(object): dumped = mapfile.dump(self) open(path, 'wb').write(dumped) + def export(self, path): + from exporter import KPMapExporter + exp = KPMapExporter(self) + data = exp.build() + open(path, 'wb').write(data) + def __init__(self): self.filePath = None |