Mercurial > parpg-core
diff src/parpg/gamemap.py @ 182:59c9ce2b8351
PARPG now works with, and needs Fife 0.3.3.
author | KarstenBock@gmx.net |
---|---|
date | Tue, 11 Oct 2011 14:47:37 +0200 |
parents | ad75fa042b99 |
children |
line wrap: on
line diff
--- a/src/parpg/gamemap.py Mon Oct 10 15:13:56 2011 +0200 +++ b/src/parpg/gamemap.py Tue Oct 11 14:47:37 2011 +0200 @@ -14,6 +14,7 @@ # along with PARPG. If not, see <http://www.gnu.org/licenses/>. from fife import fife +from fife.extensions import pychan from fife.extensions.loaders import loadMapFile class GameMap(fife.MapChangeListener): @@ -101,21 +102,21 @@ self.target_rotation = self.cameras[self.my_cam_id].getRotation() - self.outline_renderer = fife.InstanceRenderer.\ - getInstance( - self.cameras[ - self.my_cam_id - ]) + self.outline_renderer = ( + fife.InstanceRenderer.getInstance(self.cameras[self.my_cam_id]) + ) # set the render text - rend = fife.FloatingTextRenderer.getInstance(self.cameras[ - self.my_cam_id - ]) - text = self.engine.getGuiManager().createFont('fonts/rpgfont.png', - 0, - self.settings.fife.FontGlyphs) + rend = fife.FloatingTextRenderer.getInstance( + self.cameras[self.my_cam_id] + ) + font = pychan.manager.hook.guimanager.createFont( + 'fonts/rpgfont.png', + 0, + self.settings.fife.FontGlyphs + ) - rend.changeDefaultFont(text) + rend.setFont(font) rend.activateAllLayers(self.map) rend.setEnabled(True) @@ -124,9 +125,9 @@ rend.activateAllLayers(self.map) # Activate the grid renderer on all layers - rend = fife.CoordinateRenderer.getInstance(self.cameras[ - self.my_cam_id - ]) + rend = fife.CoordinateRenderer.getInstance( + self.cameras[self.my_cam_id] + ) rend.setColor(0, 0, 0) rend.addActiveLayer(self.map.getLayer("GroundLayer")) @@ -137,7 +138,8 @@ """Add the player character to the map @return: None""" # Update gamestate.player_character - self.model.game_state.getObjectById("PlayerCharacter").fifeagent.behaviour.onNewMap(self.agent_layer) + player = self.model.game_state.getObjectById("PlayerCharacter") + player.fifeagent.behaviour.onNewMap(self.agent_layer) self.centerCameraOnPlayer() def toggleRenderer(self, r_name): @@ -167,5 +169,5 @@ def centerCameraOnPlayer(self): """Center the camera on the player""" camera = self.cameras[self.my_cam_id] - player_agent = self.model.game_state.getObjectById("PlayerCharacter").fifeagent.behaviour.agent - camera.setLocation(player_agent.getLocation()) + player = self.model.game_state.getObjectById("PlayerCharacter") + camera.setLocation(player.fifeagent.behaviour.getLocation())