コード例 #1
0
    def spawn(world, cfg, pos=None):
        get_random_point = lambda: getPositionAwayFromOtherObjects(
            world, cfg.getint("WormHole", "buffer_exit_object"),
            cfg.getint("WormHole", "buffer_exit_edge"))

        if pos == None:
            pos = getPositionAwayFromOtherObjects(
                world, cfg.getint("WormHole", "buffer_object"),
                cfg.getint("WormHole", "buffer_edge"))
        wht = random.choice(eval(cfg.get("WormHole", "types")))
        if wht == WormHole.RANDOM:
            p = WormHole(pos, whtype=WormHole.RANDOM, exitpos=get_random_point)
        elif wht == WormHole.FIXED_POINT:
            p = WormHole(pos,
                         whtype=WormHole.FIXED_POINT,
                         exitpos=get_random_point())
        elif wht == WormHole.OTHER_CELESTIALBODY:
            pos2 = getPositionAwayFromOtherObjects(
                world, cfg.getint("WormHole", "buffer_object"),
                cfg.getint("WormHole", "buffer_edge"))
            p2 = WormHole(pos2, whtype=WormHole.OTHER_CELESTIALBODY)
            world.append(p2)

            p = WormHole(pos, whtype=WormHole.OTHER_CELESTIALBODY)

            p.link_wormhole(p2)
            p2.link_wormhole(p)
        world.append(p)
        return p
コード例 #2
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Asteroid", "buffer_object"),
             cfg.getint("Asteroid", "buffer_edge"))
     a = Asteroid(pos, cfg_rand_min_max(cfg, "Asteroid", "move_speed"))
     world.append(a)
     return a
コード例 #3
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Constellation", "buffer_object"),
             cfg.getint("Constellation", "buffer_edge"))
     a = Constellation(pos)
     world.append(a)
     return a
コード例 #4
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Quasar", "buffer_object"),
             cfg.getint("Quasar", "buffer_edge"))
     n = Quasar(pos, random.choice(eval(cfg.get("Quasar", "sizes"))),
                cfg_rand_min_max(cfg, "Quasar", "pull"))
     world.append(n)
     return n
コード例 #5
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("SpaceMine", "buffer_object"), cfg.getint("SpaceMine", "buffer_edge"))
     t = random.choice(eval(cfg.get("SpaceMine", "types")))
     if t == SpaceMine.AUTONOMOUS:
         sm = SpaceMine(pos, cfg_rand_min_max(cfg, "SpaceMine", "delay"), t, cfg_rand_min_max(cfg, "SpaceMine", "direction"), cfg_rand_min_max(cfg, "SpaceMine", "speed"), cfg_rand_min_max(cfg, "SpaceMine", "duration"))
     else:
         sm = SpaceMine(pos, cfg_rand_min_max(cfg, "SpaceMine", "delay"), t)
     world.append(sm)
     return sm
コード例 #6
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Star", "buffer_object"),
             cfg.getint("Star", "buffer_edge"))
     s = Star(pos, cfg_rand_min_max(cfg, "Star", "range"),
              cfg_rand_min_max(cfg, "Star", "pull"),
              cfg.getfloat("Star", "dmg_mod"),
              cfg.getboolean("Planet", "pull_weapon"))
     world.append(s)
     return s
コード例 #7
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("BlackHole", "buffer_object"),
             cfg.getint("BlackHole", "buffer_edge"))
     bh = BlackHole(pos, cfg_rand_min_max(cfg, "BlackHole", "range"),
                    cfg_rand_min_max(cfg, "BlackHole", "pull"),
                    cfg.getfloat("BlackHole", "crush_time"),
                    cfg.getboolean("Planet", "pull_weapon"))
     world.append(bh)
     return bh
コード例 #8
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Planet", "buffer_object"),
             cfg.getint("Planet", "buffer_edge"))
     p = Planet(pos,
                cfg_rand_min_max(cfg, "Planet", "range"),
                cfg_rand_min_max(cfg, "Planet", "pull"),
                torpedo=cfg.getboolean("Planet", "pull_weapon"))
     world.append(p)
     return p
コード例 #9
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Dragon", "buffer_object"), cfg.getint("Dragon", "buffer_edge"))
     d = Dragon(pos, cfg_rand_min_max(cfg, "Dragon", "range"), 
                     cfg_rand_min_max(cfg, "Dragon", "attack_speed"), 
                     cfg_rand_min_max(cfg, "Dragon", "health"),
                     (cfg.getfloat("Dragon", "attack_time_min"), cfg.getfloat("Dragon", "attack_time_max")),
                     (cfg.getfloat("Dragon", "attack_amount_min"), cfg.getfloat("Dragon", "attack_amount_max")),
                     cfg_rand_min_max(cfg, "Dragon", "move_speed")
                     )
     world.append(d)
     return d
コード例 #10
0
    def spawn(world, cfg, pos=None):
        get_random_point = lambda : getPositionAwayFromOtherObjects(world, cfg.getint("WormHole", "buffer_exit_object"), cfg.getint("WormHole", "buffer_exit_edge"))

        if pos == None:
            pos = getPositionAwayFromOtherObjects(world, cfg.getint("WormHole", "buffer_object"), cfg.getint("WormHole", "buffer_edge"))
        wht = random.choice(eval(cfg.get("WormHole", "types")))
        if wht == WormHole.RANDOM:
            p = WormHole(pos, whtype=WormHole.RANDOM, exitpos=get_random_point)
        elif wht == WormHole.FIXED_POINT:
            p = WormHole(pos, whtype=WormHole.FIXED_POINT, exitpos=get_random_point())
        elif wht == WormHole.OTHER_CELESTIALBODY:
            pos2 = getPositionAwayFromOtherObjects(world, cfg.getint("WormHole", "buffer_object"), cfg.getint("WormHole", "buffer_edge"))
            p2 = WormHole(pos2, whtype=WormHole.OTHER_CELESTIALBODY)
            world.append(p2)

            p = WormHole(pos, whtype=WormHole.OTHER_CELESTIALBODY)
            
            p.link_wormhole(p2)
            p2.link_wormhole(p)
        world.append(p)
        return p
コード例 #11
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("SpaceMine", "buffer_object"),
             cfg.getint("SpaceMine", "buffer_edge"))
     t = random.choice(eval(cfg.get("SpaceMine", "types")))
     if t == SpaceMine.AUTONOMOUS:
         sm = SpaceMine(pos, cfg_rand_min_max(cfg, "SpaceMine", "delay"), t,
                        cfg_rand_min_max(cfg, "SpaceMine", "direction"),
                        cfg_rand_min_max(cfg, "SpaceMine", "speed"),
                        cfg_rand_min_max(cfg, "SpaceMine", "duration"))
     else:
         sm = SpaceMine(pos, cfg_rand_min_max(cfg, "SpaceMine", "delay"), t)
     world.append(sm)
     return sm
コード例 #12
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(
             world, cfg.getint("Dragon", "buffer_object"),
             cfg.getint("Dragon", "buffer_edge"))
     d = Dragon(pos, cfg_rand_min_max(cfg, "Dragon", "range"),
                cfg_rand_min_max(cfg, "Dragon", "attack_speed"),
                cfg_rand_min_max(cfg, "Dragon", "health"),
                (cfg.getfloat("Dragon", "attack_time_min"),
                 cfg.getfloat("Dragon", "attack_time_max")),
                (cfg.getfloat("Dragon", "attack_amount_min"),
                 cfg.getfloat("Dragon", "attack_amount_max")),
                cfg_rand_min_max(cfg, "Dragon", "move_speed"))
     world.append(d)
     return d
コード例 #13
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Constellation", "buffer_object"), cfg.getint("Constellation", "buffer_edge"))
     a = Constellation(pos)
     world.append(a)
     return a
コード例 #14
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Planet", "buffer_object"), cfg.getint("Planet", "buffer_edge"))
     p = Planet(pos, cfg_rand_min_max(cfg, "Planet", "range"), cfg_rand_min_max(cfg, "Planet", "pull"), torpedo=cfg.getboolean("Planet", "pull_weapon"))
     world.append(p)
     return p
コード例 #15
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("BlackHole", "buffer_object"), cfg.getint("BlackHole", "buffer_edge"))
     bh = BlackHole(pos, cfg_rand_min_max(cfg, "BlackHole", "range"), cfg_rand_min_max(cfg, "BlackHole", "pull"), cfg.getfloat("BlackHole", "crush_time"), cfg.getboolean("Planet", "pull_weapon"))
     world.append(bh)
     return bh
コード例 #16
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Nebula", "buffer_object"), cfg.getint("Nebula", "buffer_edge"))
     n = Nebula(pos, random.choice(eval(cfg.get("Nebula", "sizes"))), cfg_rand_min_max(cfg, "Nebula", "pull"))
     world.append(n)
     return n
コード例 #17
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Asteroid", "buffer_object"), cfg.getint("Asteroid", "buffer_edge"))
     a = Asteroid(pos, cfg_rand_min_max(cfg, "Asteroid", "move_speed"))
     world.append(a)
     return a
コード例 #18
0
 def spawn(world, cfg, pos=None):
     if pos == None:
         pos = getPositionAwayFromOtherObjects(world, cfg.getint("Star", "buffer_object"), cfg.getint("Star", "buffer_edge"))
     s = Star(pos, cfg_rand_min_max(cfg, "Star", "range"), cfg_rand_min_max(cfg, "Star", "pull"), cfg.getfloat("Star", "dmg_mod"), cfg.getboolean("Planet", "pull_weapon"))
     world.append(s)
     return s