Changeset 310 for trunk/game/scripts/objects
- Timestamp:
- 10/09/09 20:03:08 (10 years ago)
- Location:
- trunk/game/scripts/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/game/scripts/objects/__init__.py
r262 r310 15 15 # You should have received a copy of the GNU General Public License 16 16 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. 17 import containers 17 import containers, doors 18 18 import actors 19 19 import sys 20 20 21 object_modules = [containers, actors, ]21 object_modules = [containers, actors, doors] 22 22 23 23 def getAllObjects (): … … 50 50 info[key] = val 51 51 52 # this is for testing purposes 52 53 return getAllObjects()[obj_type](ID, **info) -
trunk/game/scripts/objects/action.py
r287 r310 24 24 class ChangeMapAction(Action): 25 25 """A change map scheduled""" 26 def __init__(self, engine, targetmap, targetpos): 27 """@type engine: Engine reference 26 def __init__(self, engine, targetmapname, targetmapfile , targetpos): 27 """Initiates a change of the position of the character 28 possibly flagging a new map to be loaded. 29 @type engine: Engine reference 28 30 @param engine: A reference to the engine. 29 @type targetmap: String 30 @param targetmap: Target mapname. 31 @type targetmapname: String 32 @param targetmapname: Target map id 33 @type targetmapfile: String 34 @param targetmapfile: Target map filename 31 35 @type targetpos: Tuple 32 36 @param targetpos: (X, Y) coordinates on the target map. … … 34 38 self.engine = engine 35 39 self.targetpos = targetpos 36 self.targetmap = targetmap 37 40 self.targetmapname = targetmapname 41 self.targetmapfile = targetmapfile 42 38 43 def execute(self): 39 44 """Executes the mapchange.""" 40 self.engine.changeMap(self.targetmap , self.targetpos)45 self.engine.changeMap(self.targetmapname, self.targetmapfile, self.targetpos) 41 46 42 47 class OpenBoxAction(Action): -
trunk/game/scripts/objects/actors.py
r295 r310 136 136 self.state = _AGENT_STATE_RUN 137 137 self.behaviour.agent.move('walk', location, self.behaviour.speed-1) 138 138 139 def teleport(self, location): 140 """Teleports a PC instantly to the given location. 141 @type location: fife.Location 142 @param location: Target coordinates for PC. 143 @return: None""" 144 self.state = _AGENT_STATE_IDLE 145 self.behaviour.agent.setLocation(location) 146 139 147 def approach(self, location, action = None): 140 148 """Approaches an npc and then ???. -
trunk/game/scripts/objects/composed.py
r262 r310 31 31 Destructable .__init__(self, **kwargs) 32 32 self.blocking = True 33 34 class Door(GameObject, Lockable, Scriptable, Trappable): 35 """Composite class that can be used to create doors on a map.""" 36 def __init__ (self, target_map_name = 'my-map', target_map = 'map/map.xml', target_pos = (0.0, 0.0), \ 37 **kwargs): 38 GameObject .__init__(self, **kwargs) 39 Lockable .__init__(self, **kwargs) 40 Scriptable .__init__(self, **kwargs) 41 Trappable .__init__(self, **kwargs) 42 self.is_door = True 43 self.target_map_name = target_map_name 44 self.target_map = target_map 45 self.target_pos = target_pos 46 self.blocking = True
Note: See TracChangeset
for help on using the changeset viewer.