コード例 #1
0
ファイル: game.py プロジェクト: chris-statzer/survivebynine
class Spawner(object):
    """
        Will be updated by the main loop. These spawners should randonly
        spawn a molecule and track the ones it has spawned. It should
        accept a limit to how many it may have active. 
    """

    def __init__(self, points):
        self.points = points
        self.level = 3
        self.molecules = []
        self.mf = MoleculeFactory()
        self.max_spawns = 21

    def update(self, dt):
        if len(self.molecules) < self.max_spawns:
            s = self.points[randint(0, len(self.points)) - 1]
            m = self.mf.make_molecule((0, self.level), s[0], s[1])
            m.spawner = self
            self.molecules.append(m)
コード例 #2
0
ファイル: game.py プロジェクト: chris-statzer/survivebynine
 def __init__(self, points):
     self.points = points
     self.level = 3
     self.molecules = []
     self.mf = MoleculeFactory()
     self.max_spawns = 21