|
def _map_(index,ox,oy,width,height,kind = 0,p = false)
if p
width = width - ox + 1
height = height - oy + 1
end
s_index = index.to_s
for i in 0...3-s_index.size
s_index = "0"+s_index
end
f = load_data("Data/Map"+s_index+".rvdata")
tmp = Table.new(ox+width,oy+height,3)
for x in ox...ox+width
for y in oy...oy+height
for i in 0..3
tmp[x,y,i] = f.data[x,y,i]
end
end
end
for x in 0...width
for y in 0...height
for i in 0..3
case kind
when 0 # 水平变换
f.data[ox+x,oy+y,i] = tmp[ox+width-x-1,oy+y,i]
when 1 # 垂直变换
f.data[ox+x,oy+y,i] = tmp[ox+x,oy+height-y-1,i]
when 2 # 旋转180度
f.data[ox+x,oy+y,i] = tmp[ox+width-x-1,oy+height-y-1,i]
when 3 # 逆时针旋转90度
f.data[ox+x,oy+y,i] = tmp[ox+y,oy+x,i] if y < width && x < height
end
end
end
end
save_data(f,"Data/Map"+s_index+".rvdata")
end
_map_(59,5,5,33,33,3,true)
贴到脚本的最前面 _map_(index,ox,oy,width,height,kind = 0,p = false)
是调用方法
index 地图编号
ox oy 需要做变换地图的矩形的起始点的XY坐标
width height 有两种。。。。一个是矩形的宽和高 当 最后一个参数p为true时,这两个参数是矩形最右下角点的XY坐标
kind 0 水平变换 1垂直变化 2 180度旋转 3 逆时针90度旋转
p 看 width 和height 的介绍那个吧 |
|