Browse Source

Game over if there's only monsters

pull/1/head
theo@manjaro 10 months ago
parent
commit
d9f632072a
  1. 7
      gamedata/objects/ingame/manager.py

7
gamedata/objects/ingame/manager.py

@ -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))

Loading…
Cancel
Save