# HG changeset patch # User KarstenBock@gmx.net # Date 1316783307 -7200 # Node ID bb9e2f2548c647964abbed6506589ae4c5c8475a # Parent 43e7a8d94446d892313228bc58e039bd7cdb9d33 Added moveObject method to the GameModel class. diff -r 43e7a8d94446 -r bb9e2f2548c6 gamemodel.py --- a/gamemodel.py Fri Sep 23 14:43:06 2011 +0200 +++ b/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