PinmikPanik/gamedata/objects/ingame/manager.py

33 lines
1.1 KiB
Python

from gamedata.objects.base import BaseObject
from gamedata.objects.ingame.spawner import Spawner
from gamedata.objects.ingame.tiles import Tiles
class Manager(BaseObject):
def __init__(self,game):
super().__init__(0,0,game)
self.score = 0
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)
# Spawn the first one
self.game.gameloop.summon(Spawner(self.game,self.tiles))
def step(self):
for i in self.game.gameloop.findname("Lemming"):
self.score+=self.scoreratio*self.game.dt
if self.spawntimer.tick(self.game.dt):
self.game.gameloop.summon(Spawner(self.game,self.tiles))
self.basetime+=self.steptime
self.spawntimer = self.game.lib.Timer(self.basetime)
def draw(self):
pass