Mercurial > fife-parpg
comparison demos/shooter/scripts/world.py @ 454:bd7e8f708adf
Time is now managed by the Scene object.
Enemy projectiles are now a bit slower.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 06 Apr 2010 21:25:10 +0000 |
parents | cf53848fb187 |
children | e686b82d93d0 |
comparison
equal
deleted
inserted
replaced
453:cf53848fb187 | 454:bd7e8f708adf |
---|---|
31 from fife.extensions.loaders import loadMapFile | 31 from fife.extensions.loaders import loadMapFile |
32 | 32 |
33 from scripts.ships.shipbase import Ship | 33 from scripts.ships.shipbase import Ship |
34 from scripts.ships.player import Player | 34 from scripts.ships.player import Player |
35 from scripts.scene import Scene | 35 from scripts.scene import Scene |
36 from scripts.weapons import Weapon | |
37 | 36 |
38 class World(EventListenerBase): | 37 class World(EventListenerBase): |
39 """ | 38 """ |
40 The world! | 39 The world! |
41 | 40 |
74 self.filename = filename | 73 self.filename = filename |
75 self.reset() | 74 self.reset() |
76 self.map = loadMapFile(filename, self.engine) | 75 self.map = loadMapFile(filename, self.engine) |
77 | 76 |
78 self.scene = Scene(self.engine, self.map.getLayer('objects')) | 77 self.scene = Scene(self.engine, self.map.getLayer('objects')) |
79 #self.initPlayer() | |
80 self.initCameras() | |
81 | 78 |
82 self.mainwindow = pychan.loadXML('gui/mainwindow.xml') | 79 self.mainwindow = pychan.loadXML('gui/mainwindow.xml') |
83 self.fpstext = self.mainwindow.findChild(name="fps") | 80 self.fpstext = self.mainwindow.findChild(name="fps") |
84 self.velocitytext = self.mainwindow.findChild(name="velocity") | 81 self.velocitytext = self.mainwindow.findChild(name="velocity") |
85 self.positiontext = self.mainwindow.findChild(name="position") | 82 self.positiontext = self.mainwindow.findChild(name="position") |
86 self.scoretext = self.mainwindow.findChild(name="score") | 83 self.scoretext = self.mainwindow.findChild(name="score") |
87 self.mainwindow.position = (0,0) | 84 self.mainwindow.position = (0,0) |
88 self.mainwindow.show() | 85 self.mainwindow.show() |
89 | 86 |
90 #give player the default weapon | |
91 self.scene.player.weapon = Weapon(self.scene, self.scene.player, 200) | |
92 self.scene.initScene(self.map) | 87 self.scene.initScene(self.map) |
88 self.initCameras() | |
93 | 89 |
94 def initCameras(self): | 90 def initCameras(self): |
95 """ | 91 """ |
96 Before we can actually see something on screen we have to specify the render setup. | 92 Before we can actually see something on screen we have to specify the render setup. |
97 This is done through Camera objects which offer a viewport on the map. | 93 This is done through Camera objects which offer a viewport on the map. |