comparison src/parpg/gamemodel.py @ 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 9b5498e3bda0
comparison
equal deleted inserted replaced
113:7b0846025412 114:b10d12fbbb3f
133 raise ValueError( 133 raise ValueError(
134 "Number exceeds MAX_ID_NUMBER:" + str(self.MAX_ID_NUMBER)) 134 "Number exceeds MAX_ID_NUMBER:" + str(self.MAX_ID_NUMBER))
135 135
136 ID = ID + "_" + str(id_number) 136 ID = ID + "_" + str(id_number)
137 return ID 137 return ID
138
139 def moveObject(self, object_id, new_map):
140 """Moves the object to a new map, or in a container
141 @param object_id: ID of the object
142 @type object_id: str
143 @param new_map: ID of the new map, or None
144 @type object_id: str """
145 game_object = self.game_state.getObjectById(object_id)
146 self.deleteObject(object_id)
147 self.game_state.addObject(object_id, new_map, game_object)
138 148
139 def deleteObject(self, object_id): 149 def deleteObject(self, object_id):
140 """Removes an object from the game 150 """Removes an object from the game
141 @param object_id: ID of the object 151 @param object_id: ID of the object
142 @type object_id: str """ 152 @type object_id: str """