def main(): world = PacmanWorld( 20, '/Users/christopherluey/Desktop/pacmanAI-master/PacmanAI/levels/pacman.txt' ) display = PacmanDisplay(world) world.spawn_player(KeyboardAgent) world.spawn_ghost(RandomGhost) world.spawn_ghost(RandomGhost) world.spawn_ghost(RandomGhost) world.spawn_ghost(RandomGhost) world.spawn_ghost(RandomGhost) world.spawn_ghost(RandomGhost) world.player_lives = 1 pyafai.run()
def main(): world = pyafai.World2D() display = pyafai.Display(world) obj = objects.pingPong(200,200) print("asdfsgdfsg"); shape = shapes.Circle(10) obj.add_shape(shape) obj.angle = randint(10,360) obj.velocity = 300#randint(50,350) world.add_object(obj) pyafai.run()
def main(): world = pyafai.World2DGrid(10, 10, 30, True) display = MyDisplay(world) obj = pyafai.Object(20, 30) shape = pyafai.shapes.Circle(10, color=('c3B', (180, 0, 0))) obj.add_shape(shape) world.add_object(obj) obj = pyafai.Object(4, 8) shape = pyafai.shapes.Circle(10, color=('c3B', (180, 180, 0))) obj.add_shape(shape) agent = pyafai.Agent() agent.body = obj world.add_agent(agent) pyafai.run()
shape = shapes.Pointer(10, color=color) obj.add_shape(shape) obj.velocity = vel self.body = obj self._last_think = 0.0 def _think(self, delta): self._last_think += delta if self._last_think >= 0.2: self._last_think = 0 rotate = random.choice((-180,0,180)) self.body.ang_velocity = rotate return [] if __name__ == '__main__': world = pyafai.World2D(WORLD_WIDTH, WORLD_HEIGHT) display = pyafai.Display(world) for i in range(30): walker = RandomWalker(random.randint(10, WORLD_WIDTH-10), random.randint(10, WORLD_HEIGHT-10), random.randint(50,200), ('c3B', (random.randint(0,255), random.randint(0,255), random.randint(0,255)))) walker.body.angle = random.randint(0,359) world.add_agent(walker) pyafai.run()