Mercurial > fife-parpg
comparison demos/rpg/scripts/scene.py @ 513:edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
Added a help file for the console.
Added a KeyState class for keeping track of the state of the keys.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 21 May 2010 20:33:43 +0000 |
parents | 6ddb1eb9dfa6 |
children | d70fc46c8aa5 |
comparison
equal
deleted
inserted
replaced
512:6ddb1eb9dfa6 | 513:edf5c0cf52f3 |
---|---|
27 import sys, os, re, math, random, shutil | 27 import sys, os, re, math, random, shutil |
28 | 28 |
29 from fife import fife | 29 from fife import fife |
30 from fife.extensions.loaders import loadMapFile | 30 from fife.extensions.loaders import loadMapFile |
31 | 31 |
32 from scripts.actors.player import Player | |
33 | |
32 class Scene(object): | 34 class Scene(object): |
33 def __init__(self, gamecontroller): | 35 def __init__(self, gamecontroller): |
34 self._gamecontroller = gamecontroller | 36 self._gamecontroller = gamecontroller |
35 | 37 |
36 self._map = None | 38 self._map = None |
37 self._cameras = {} | 39 self._cameras = {} |
40 | |
41 self._actorlayer = None | |
42 | |
43 self._player = None | |
38 | 44 |
39 def createScene(self, mapfilename): | 45 def createScene(self, mapfilename): |
40 if not self._map: | 46 if not self._map: |
41 self._map = loadMapFile(mapfilename, self._gamecontroller.engine) | 47 self._map = loadMapFile(mapfilename, self._gamecontroller.engine) |
42 else: | 48 else: |
45 for cam in self._map.getCameras(): | 51 for cam in self._map.getCameras(): |
46 self._cameras[cam.getId()] = cam | 52 self._cameras[cam.getId()] = cam |
47 | 53 |
48 self._cameras[self._gamecontroller.settings.get("RPG", "DefaultCameraName", "camera1")].setZoom(1.0) | 54 self._cameras[self._gamecontroller.settings.get("RPG", "DefaultCameraName", "camera1")].setZoom(1.0) |
49 | 55 |
56 self._actorlayer = self._map.getLayer(self._gamecontroller.settings.get("RPG", "ActorLayer", "actor_layer")) | |
57 | |
50 def destroyScene(self): | 58 def destroyScene(self): |
51 self._cameras.clear() | 59 self._cameras.clear() |
52 | 60 |
53 if self._map: | 61 if self._map: |
54 self._gamecontroller.engine.getModel().deleteMap(self._map) | 62 self._gamecontroller.engine.getModel().deleteMap(self._map) |
55 | 63 |
56 self._map = None | 64 self._map = None |
65 self._actorlayer = None | |
57 | 66 |
58 def updateScene(self): | 67 def updateScene(self): |
59 pass | 68 pass |
60 | 69 |
70 def _getActorLayer(self): | |
71 return self._actorlayer | |
72 | |
73 actorlayer = property(_getActorLayer) | |
74 |