Mercurial > parpg-source
changeset 84:bb9e2f2548c6
Added moveObject method to the GameModel class.
author | KarstenBock@gmx.net |
---|---|
date | Fri, 23 Sep 2011 15:08:27 +0200 |
parents | 43e7a8d94446 |
children | 04af237dde10 |
files | gamemodel.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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