diff gamestate.py @ 88:0411a4bcceee

Fixed moving between maps.
author KarstenBock@gmx.net
date Mon, 26 Sep 2011 15:44:42 +0200
parents 9e03f7816061
children 824f3068ef2a
line wrap: on
line diff
--- a/gamestate.py	Sat Sep 24 16:48:06 2011 +0200
+++ b/gamestate.py	Mon Sep 26 15:44:42 2011 +0200
@@ -54,6 +54,7 @@
             if map_id:
                 inst = self.maps[map_id].agent_layer.getInstance(object_id)
                 self.maps[map_id].agent_layer.deleteInstance(inst)
+            self.objects[map_id][object_id].delete()
             del self.objects[map_id][object_id]
             del self.object_ids[object_id]
             
@@ -69,6 +70,15 @@
         
         return {}
     
+    def deleteObjectsFromMap(self, map_id):
+        """Deletes all objects of the given map.
+           @type map: String
+           @param map: The map name.
+           @returns: None"""
+        if map_id in self.objects:
+            for obj in self.objects[map_id].copy():
+                self.deleteObject(obj)
+    
     def hasObject(self, object_id):
         """Check if an object with the given id is present 
         @param object_id: ID of the object