changeset 502:96c4922c1c24

Added some imports to the world initialization code. I had to do this because you were not able to use the editor with the shooter demo map files without manually adding the imports to the map file. You do not have to do this now (note the TODO in the comments). I have also hard coded the camera zoom level to ensure the map editors zoom level at the time of saving the map is not used.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 18 May 2010 14:48:33 +0000
parents 6614a5446352
children 892f1caf5aff
files demos/shooter/maps/shooter_map1.xml demos/shooter/scripts/world.py
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/demos/shooter/maps/shooter_map1.xml	Fri May 14 21:40:56 2010 +0000
+++ b/demos/shooter/maps/shooter_map1.xml	Tue May 18 14:48:33 2010 +0000
@@ -5,10 +5,6 @@
 	<import file="../objects/ships/saucer1/object.xml"></import>
 	<import file="../objects/ships/saucer2/object.xml"></import>
 	<import file="../objects/ships/boss1/object.xml"></import>
-	<import file="../objects/projectiles/bullet1/object.xml"></import>
-	<import file="../objects/projectiles/fireball/object.xml"></import>
-	<import file="../objects/powerups/cannonspread5/object.xml"></import>
-	<import file="../objects/powerups/extralife/object.xml"></import>
 	<layer y_scale="1.0" y_offset="0.0" pathing="cell_edges_and_diagonals" grid_type="square" id="background" rotation="0.0" x_scale="1.0" x_offset="0.0" transparency="0">
 		<instances>
 			<i o="starfield" ns="http://www.fifengine.de/xml/tutorial" x="-2.0" r="0" y="-1.0" z="0.0"></i>
--- a/demos/shooter/scripts/world.py	Fri May 14 21:40:56 2010 +0000
+++ b/demos/shooter/scripts/world.py	Tue May 18 14:48:33 2010 +0000
@@ -29,7 +29,7 @@
 from fife.extensions.soundmanager import SoundManager
 
 from scripts.common.eventlistenerbase import EventListenerBase
-from fife.extensions.loaders import loadMapFile
+from fife.extensions.loaders import loadMapFile, loadImportFile
 
 from scripts.gui.guis import *
 
@@ -137,6 +137,14 @@
 		
 		self._filename = filename
 		self.reset()
+		
+		#specific imports that needed to be added
+		#@todo: you should be able to add file imports via the map editor
+		loadImportFile("objects/projectiles/bullet1/object.xml", self._engine)
+		loadImportFile("objects/projectiles/fireball/object.xml", self._engine)
+		loadImportFile("objects/powerups/cannonspread5/object.xml", self._engine)
+		loadImportFile("objects/powerups/extralife/object.xml", self._engine)
+		
 		self._map = loadMapFile(self._filename, self._engine)
 
 		self._scene = Scene(self, self._engine, self._map.getLayer('objects'), self._soundmanager)
@@ -268,6 +276,7 @@
 		
 		#pass the camera to the scene as the scene controls the cameras position
 		self._scene.attachCamera(self.cameras['main'])
+		self.cameras['main'].setZoom(1.0)
 		
 	def resetKeys(self):
 		self._keystate['UP'] = False