Game over if there's only monsters
This commit is contained in:
parent
506930b67e
commit
d9f632072a
@ -65,16 +65,19 @@ class Manager(BaseObject):
|
|||||||
self.can_sfx = True
|
self.can_sfx = True
|
||||||
lemmings = self.game.gameloop.findname("Lemming")
|
lemmings = self.game.gameloop.findname("Lemming")
|
||||||
nblemmings = len(lemmings) + len(self.game.gameloop.findname("Spawner"))
|
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"]:
|
if not self.game.globals["pause"]:
|
||||||
for lemming in lemmings:
|
for lemming in lemmings:
|
||||||
|
if lemming.skin == "monster":
|
||||||
|
nbmonsters+=1
|
||||||
if not lemming.selected:
|
if not lemming.selected:
|
||||||
self.score+=lemming.scoreratio*self.game.dt
|
self.score+=lemming.scoreratio*self.game.dt
|
||||||
# Pausing the game
|
# Pausing the game
|
||||||
if self.game.inputs["keys"]["escape"]["timer"]==1:
|
if self.game.inputs["keys"]["escape"]["timer"]==1:
|
||||||
self.game.globals["pause"] = not self.game.globals["pause"]
|
self.game.globals["pause"] = not self.game.globals["pause"]
|
||||||
# Spawning more lemmings
|
# 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 not self.game.globals["pause"]:
|
||||||
if self.spawntimer.tick(self.game.dt):
|
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))
|
self.game.gameloop.summon(Spawner(self.game,self.tiles,speedmargin=int(self.speedmargin+0.5),skins=self.skins))
|
||||||
|
Loading…
Reference in New Issue
Block a user