Game over if there's only monsters

This commit is contained in:
theo@manjaro 2021-10-18 13:28:13 +02:00
parent 506930b67e
commit d9f632072a

View File

@ -65,16 +65,19 @@ class Manager(BaseObject):
self.can_sfx = True
lemmings = self.game.gameloop.findname("Lemming")
nblemmings = len(lemmings) + len(self.game.gameloop.findname("Spawner"))
# Updating score
# Updating score and checking if there's only monsters
nbmonsters = 0
if not self.game.globals["pause"]:
for lemming in lemmings:
if lemming.skin == "monster":
nbmonsters+=1
if not lemming.selected:
self.score+=lemming.scoreratio*self.game.dt
# Pausing the game
if self.game.inputs["keys"]["escape"]["timer"]==1:
self.game.globals["pause"] = not self.game.globals["pause"]
# Spawning more lemmings
if (self.lives>0 and nblemmings>0):
if (self.lives>0 and nblemmings>0 and (nbmonsters!=nblemmings)):
if not self.game.globals["pause"]:
if self.spawntimer.tick(self.game.dt):
self.game.gameloop.summon(Spawner(self.game,self.tiles,speedmargin=int(self.speedmargin+0.5),skins=self.skins))