def set_path(self, screen, grid, end, timelimit = .5): "sets a path for the guy to follow" self.goal = end # reset the goal #create a path using A* and smooth it up with the smoothing function if self.all_knowing == True: self.path = make_smooth(screen, self.loc,create_path(self.loc,end,grid,timelimit),grid) else: self.path = make_smooth(screen, self.loc,create_path(self.loc,end,self.known_walkability,timelimit),grid) #sometimes the path will be empty if len(self.path)>0: self.calculate_direction()#calculate the initial direction
def calculate_astar_path(self, grid): self.current_astar_path = astar.create_path((int(round(self.colrect.left / 32.0, 0)), int(round(self.colrect.top / 32.0, 0))), self.current_goal, grid) self.next_astar_node = 0