comparison demos/shooter/scripts/world.py @ 450:ba6817013343

Added score keeping ability. Some misc cleanup. Fixed the bounding box. Enemies are now removed from the scene when they are destroyed.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 01 Apr 2010 19:26:56 +0000
parents 5e2ec84902a7
children f463ab431cc0
comparison
equal deleted inserted replaced
449:1cf56403347a 450:ba6817013343
81 81
82 self.mainwindow = pychan.loadXML('gui/mainwindow.xml') 82 self.mainwindow = pychan.loadXML('gui/mainwindow.xml')
83 self.fpstext = self.mainwindow.findChild(name="fps") 83 self.fpstext = self.mainwindow.findChild(name="fps")
84 self.velocitytext = self.mainwindow.findChild(name="velocity") 84 self.velocitytext = self.mainwindow.findChild(name="velocity")
85 self.positiontext = self.mainwindow.findChild(name="position") 85 self.positiontext = self.mainwindow.findChild(name="position")
86 self.scoretext = self.mainwindow.findChild(name="score")
86 self.mainwindow.position = (0,0) 87 self.mainwindow.position = (0,0)
87 self.mainwindow.show() 88 self.mainwindow.show()
88 89
89 #give player the default weapon 90 #give player the default weapon
90 self.scene.player.weapon = Weapon(self.model, self.map.getLayer('objects'), self.scene.player, 100) 91 self.scene.player.weapon = Weapon(self.model, self.map.getLayer('objects'), self.scene.player, 100)
175 self.positiontext.text = unicode(pos) 176 self.positiontext.text = unicode(pos)
176 177
177 vel = "%1.2f" % player.velocity.x + ", %1.2f" % player.velocity.y 178 vel = "%1.2f" % player.velocity.x + ", %1.2f" % player.velocity.y
178 self.velocitytext.text = unicode(vel) 179 self.velocitytext.text = unicode(vel)
179 180
181 score = unicode(str(player.score))
182 self.scoretext.text = score
183
180 184
181 self.pump_ctr += 1 185 self.pump_ctr += 1