2021-09-11 14:33:20 +02:00
|
|
|
from gamedata.objects.base import BaseObject
|
2021-09-11 15:12:53 +02:00
|
|
|
from gamedata.objects.ingame.lemmings import Lemming
|
|
|
|
from gamedata.objects.ingame.tiles import Tiles
|
2021-09-11 14:33:20 +02:00
|
|
|
|
|
|
|
class Manager(BaseObject):
|
|
|
|
def __init__(self,game):
|
|
|
|
super().__init__(0,0,game)
|
|
|
|
self.score = 0
|
2021-09-11 15:12:53 +02:00
|
|
|
self.lives = 5
|
|
|
|
self.basetime = 10
|
|
|
|
self.steptime = 2
|
|
|
|
self.spawntimer = game.lib.Timer(self.basetime) # Time elapsing each lemming spawn
|
|
|
|
self.scoreratio = 0.4 # Points earned per seconds and per lemming
|
|
|
|
|
|
|
|
# Summon the tiles
|
|
|
|
self.tiles = Tiles(50,50,game)
|
|
|
|
game.gameloop.summon(self.tiles)
|
2021-09-11 14:33:20 +02:00
|
|
|
|
|
|
|
def step(self):
|
|
|
|
for i in self.game.gameloop.findname("Lemming"):
|
|
|
|
self.score+=self.scoreratio*self.game.dt
|
2021-09-11 15:12:53 +02:00
|
|
|
if self.spawntimer.tick(self.game.dt):
|
|
|
|
self.game.gameloop.summon(Lemming(100,100,self.game))
|
|
|
|
self.basetime+=self.steptime
|
|
|
|
self.spawntimer = self.game.lib.Timer(self.basetime)
|
2021-09-11 14:33:20 +02:00
|
|
|
|
|
|
|
def draw(self):
|
|
|
|
pass
|
|
|
|
|