changeset 114:b10d12fbbb3f

Added moveObject method to the GameModel class.
author KarstenBock@gmx.net
date Fri, 23 Sep 2011 15:08:27 +0200
parents 7b0846025412
children a85d58fcd253
files src/parpg/gamemodel.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/parpg/gamemodel.py	Fri Sep 23 14:43:06 2011 +0200
+++ b/src/parpg/gamemodel.py	Fri Sep 23 15:08:27 2011 +0200
@@ -136,6 +136,16 @@
             ID = ID + "_" + str(id_number)
         return ID
     
+    def moveObject(self, object_id, new_map):
+        """Moves the object to a new map, or in a container
+        @param object_id: ID of the object
+        @type object_id: str 
+        @param new_map: ID of the new map, or None
+        @type object_id: str """
+        game_object = self.game_state.getObjectById(object_id)
+        self.deleteObject(object_id)
+        self.game_state.addObject(object_id, new_map, game_object)
+    
     def deleteObject(self, object_id):
         """Removes an object from the game
         @param object_id: ID of the object