|
|
|
@ -8,7 +8,7 @@ from gamedata.objects.ingame.demo import Demo
|
|
|
|
|
class Manager(BaseObject):
|
|
|
|
|
def __init__(self,game):
|
|
|
|
|
super().__init__(0,0,game)
|
|
|
|
|
self.score = 250
|
|
|
|
|
self.score = 0
|
|
|
|
|
self.lives = 5
|
|
|
|
|
self.basetime = 10
|
|
|
|
|
self.steptime = 2
|
|
|
|
@ -18,7 +18,6 @@ class Manager(BaseObject):
|
|
|
|
|
self.deathtimer = game.lib.Timer(1) # Time between each life loss
|
|
|
|
|
self.started = False
|
|
|
|
|
self.invincible = False
|
|
|
|
|
self.scoreratio = 0.2 # Points earned per seconds and per lemming
|
|
|
|
|
|
|
|
|
|
self.endtimer = game.lib.Timer(1) # Black fade if game's over
|
|
|
|
|
self.endrect = game.pygame.Surface((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT))
|
|
|
|
@ -50,10 +49,11 @@ class Manager(BaseObject):
|
|
|
|
|
self.game.gameloop.summon(Spawner(self.game,self.tiles,skins=self.skins))
|
|
|
|
|
|
|
|
|
|
def step(self):
|
|
|
|
|
nblemmings = len(self.game.gameloop.findname("Lemming")) + len(self.game.gameloop.findname("Spawner"))
|
|
|
|
|
lemmings = self.game.gameloop.findname("Lemming")
|
|
|
|
|
nblemmings = len(lemmings) + len(self.game.gameloop.findname("Spawner"))
|
|
|
|
|
# Updating score
|
|
|
|
|
for i in range(nblemmings):
|
|
|
|
|
self.score+=self.scoreratio*self.game.dt
|
|
|
|
|
for lemming in lemmings:
|
|
|
|
|
self.score+=lemming.scoreratio*self.game.dt
|
|
|
|
|
# Spawning more lemmings
|
|
|
|
|
if (self.lives>0 and nblemmings>0):
|
|
|
|
|
if self.spawntimer.tick(self.game.dt):
|
|
|
|
|