跳到主要内容

FAStarBase.set_size

声明

public void set_size(int width, int height)

参数

参数名描述
width地图宽度
height地图高度

作用

该接口用来设置地图的宽高

使用方式

map.gs

component pkg.astar.components.FAStarBase;

void create(array para)
{
this.init_map(para);
}

test.gs

array grids = 
[
[0, 0, 0, 0, 1, 1, 0, 1, 0, 1],
[1, 0, 0, 0, 1, 1, 0, 1, 0, 1],
[1, 1, 0, 0, 1, 1, 0, 1, 0, 1],
[1, 1, 1, 0, 1, 1, 0, 1, 0, 1],
[0, 1, 0, 0, 1, 1, 0, 1, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 0, 1],
[0, 0, 0, 0, 1, 1, 0, 0, 0, 1],
[0, 0, 0, 0, 1, 1, 1, 1, 0, 1],
[0, 0, 0, 0, 1, 1, 0, 1, 0, 1],
[0, 0, 0, 0, 1, 1, 1, 0, 1, 1],
];

object m = new_object(map, this_domain(), grids);

write(m.get_width());

m.set_width(20, 20);

write(m.get_width());

返回文档