跳到主要内容

astarex

简介

A*寻路扩展

组件接口

astarex.gs

函数原型函数作用
object create_ob(mixed grid_call, bool ignore_obstacle, int max_step, mixed get_g_call, mixed get_h_call)创建寻路对象
object create_ob_with_map(array grid, bool is_diag_move, bool ignore_obstacle, int max_step)通过地图创建寻路对象
int get_around_grids_address()获得相邻节点地址
int get_g_value_address()获得g权重算法函数地址
int get_h_value_address()获得h权重算法函数地址

AStarExImpl.gs

A*寻路对象

函数原型函数作用
void init(mixed around_girds_func, mixed g_value_func, mixed h_vall_func, bool ignore_obstacle, int max_step)初始化寻路对象
int get_g_value(int x1, int y1, int x2, int y2)获得g权重
int get_h_value(int x1, int y1, int x2, int y2)获得h权重
int get_around_grids(int directions_ptr, int curx, int cury, int cookie)获得相邻节点
void set_ignore_obstacle(bool ignore_obstacle)设置是否忽略障碍
bool is_ignore_obstacle()是否忽略障碍
void set_max_step(int max_step)设置最大寻路步数
int get_max_step()最大寻路步数
array find_path(int startx, int starty, int endx, int endy, function around_girds_func)寻路

AStarImpl.gs

A*寻路对象

函数原型函数作用
void update_map(array para, bool is_diag_move, bool bclear_collision, bool ignore_obstacle, int max_step)更新地图
void set_collision(int x, int y, int status)设置障碍
void remove_collision(int x, int y)删除障碍
void clear_collisions()清空障碍
int get_pos_status(int x, int y)获取坐标障碍信息
void set_ignore_obstacle(bool ignore_obstacle)设置是否忽略障碍
bool is_ignore_obstacle()是否忽略障碍
void set_max_step(int max_step)设置最大寻路步数
int get_max_step()最大寻路步数
array find_path(int startx, int starty, int endx, int endy, map extra_walls)寻路

枚举

MapWall


Empty = 0,
RightWall = 1,
LeftWall = 2,
BottomWall = 4,
TopWall = 8,
Block = TopWall | BottomWall | RightWall | LeftWall,