summaryrefslogtreecommitdiff
path: root/src/mapdata.py
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-11-17 03:38:06 +0100
committerTreeki <treeki@gmail.com>2011-11-17 03:38:06 +0100
commit7bb952ac294991753b86a7075007070676baafb9 (patch)
tree8a8240ae8f974f9595c138ecf122af07c84de350 /src/mapdata.py
parentb336977192da8208e3fe1521e68f130c62ea9e04 (diff)
downloadkoopatlas-7bb952ac294991753b86a7075007070676baafb9.tar.gz
koopatlas-7bb952ac294991753b86a7075007070676baafb9.zip
unfinished code for doodads
Diffstat (limited to '')
-rw-r--r--src/mapdata.py65
1 files changed, 42 insertions, 23 deletions
diff --git a/src/mapdata.py b/src/mapdata.py
index 2f1f5a2..53331c5 100644
--- a/src/mapdata.py
+++ b/src/mapdata.py
@@ -4,19 +4,6 @@ TILE_SIZE = (24,24)
MAP_SIZE_IN_TILES = (512,512)
MAP_SIZE = (MAP_SIZE_IN_TILES[0] * TILE_SIZE[0], MAP_SIZE_IN_TILES[1] * TILE_SIZE[1])
-class KPObject(object):
- def __init__(self):
- self.position = (0,0)
- self.size = (1,1)
- self.kind = 0
- self.cache = []
- self.tileset = None
- self.qtItem = None
-
- def updateCache(self):
- self.cache = self.kind.render(self.size)
-
-
class KPLayer(object):
def __repr__(self):
return "<KPLayer %r>" % self.name
@@ -41,6 +28,19 @@ class KPLayer(object):
pass
+class KPObject(object):
+ def __init__(self):
+ self.position = (0,0)
+ self.size = (1,1)
+ self.kind = 0
+ self.cache = []
+ self.tileset = None
+ self.qtItem = None
+
+ def updateCache(self):
+ self.cache = self.kind.render(self.size)
+
+
class KPTileLayer(KPLayer):
def __repr__(self):
return "<KPTileLayer %r with %r>" % (self.name, self.tileset)
@@ -111,6 +111,27 @@ class KPTileLayer(KPLayer):
y += 1
+class KPDoodad(object):
+ def __init__(self):
+ self.position = (0,0)
+ self.angle = 0
+ self.scale = (0,0)
+
+
+class KPDoodadLayer(KPLayer):
+ def __repr__(self):
+ return "<KPDoodadLayer %r>" % self.name
+
+ def __init__(self):
+ KPLayer.__init__(self)
+ self.objects = []
+
+ def _visibilityChanged(self, value):
+ for obj in self.objects:
+ item = obj.qtItem
+ if item:
+ item.setVisible(value)
+
class KPNodeAction(object):
@@ -138,22 +159,14 @@ class KPPath(object):
self.segments = []
-class KPDoodad(object):
- def __init__(self):
- self.position = (0,0)
- self.angle = 0
- self.scale = (0,0)
-
-
class KPMap(object):
def __init__(self):
self.nextLayerNumber = 1
- self.layers = [self.createNewLayer('Test') for x in range(4)]
+ self.layers = [self.createNewTileLayer('Test') for x in range(4)]
self.layerModel = KPMap.LayerModel(self.layers)
self.nodes = []
self.paths = []
- self.doodads = []
self.tilesets = {}
self.loadedTilesets = {}
@@ -220,13 +233,19 @@ class KPMap(object):
return False
- def createNewLayer(self, tilesetName):
+ def createNewTileLayer(self, tilesetName):
layer = KPTileLayer()
layer.name = "Layer %d" % self.nextLayerNumber
self.nextLayerNumber += 1
layer.tileset = tilesetName
return layer
+ def createNewDoodadLayer(self):
+ layer = KPDoodadLayer()
+ layer.name = "Layer %d" % self.nextLayerNumber
+ self.nextLayerNumber += 1
+ return layer
+
def appendLayer(self, layer):
return self.insertLayer(len(self.layers), layer)