Beispiel #1
0
 def shoot(self):
     m = mover.Mover(self.spawnpos.x, self.spawnpos.y)
     init_velocity_mag = 20
     init_velocity = pvector.PVector(init_velocity_mag,
                                     math.radians(self.angle+90),
                                     False)
     m.velocity.add(init_velocity)
     return m
Beispiel #2
0
    def __init__(self):
        super(Bounce, self).__init__()

        self.movers = [
            mover.Mover(self.WINDOWWIDTH, self.WINDOWHEIGHT)
            for _ in range(15000)
        ]

        self.movers = [m for m in self.movers if self.is_in_circle(m)]

        pygame.mouse.set_visible(False)
Beispiel #3
0
 def getMoversForPlane(self):
     for mov in self.scenario['objects']:
         movementType = (
             defs.getMovementTypeFromString(mov["movementType"])
         ) if "movementType" in mov else defs.MovementType.STATIC
         startPoint = mov["startingPixel"]
         paceLength = mov["paceLength"] if "paceLength" in mov else 0
         radius = mov["radius"] if "radius" in mov else 10
         movementDirection = (
             defs.getMovementDirectionFromString(mov["movementDirection"])
         ) if "movementDirection" in mov else defs.MovementDirection.VERTICALUP
         m = mover.Mover(movementType,
                         startPoint,
                         self.domainSize,
                         pacelength=paceLength,
                         radius=radius,
                         movementDirection=movementDirection)
         self.movers.append(m)
     return self.movers
Beispiel #4
0
    def do_setup(self, world):
        self.log.info("Setup")
        self.world = world
        self.explorer_dispatcher = explorer_dispatcher.ExplorerDispatcher(
                world, self)
        self.warrior_dispatcher = warrior_dispatcher.WarriorDispatcher(
                world, self)
        self.defender_dispatcher = defender_dispatcher.DefenderDispatcher(
                world, self)

        self.dispatchers = [self.explorer_dispatcher,
                            self.warrior_dispatcher,
                            self.defender_dispatcher]
        self.mover = mover.Mover(world, self)

        self.ants_tracker = TimeTracker(0)
        self.preloop_tracker = TimeTracker(0)
        self.postloop_tracker = TimeTracker(0)
        castar.setup(world.map, world)

        self.explored_map = np.zeros(world.map.shape, dtype = np.bool)
Beispiel #5
0
    def __init__(self):
        super(PullEachOther, self).__init__()

        self.movers = [
            mover.Mover(self.WINDOWWIDTH, self.WINDOWHEIGHT) for _ in range(2)
        ]
Beispiel #6
0
    def __init__(self):
        super(WindyBall, self).__init__()

        self.movers = [
            mover.Mover(self.WINDOWWIDTH, self.WINDOWHEIGHT) for _ in range(1)
        ]