|
发表于 2008-6-11 23:46:50
|
显示全部楼层
按我的想法,改了下
[codes=jass]function RegionAddCircle takes region whichRegion, real x, real y, real radius returns nothing
local real delta = radius / 32
local real r = 16
local real w = 0
local rect t = Rect(0, 0, 0, 0)
if delta < r then
set r = delta
else
set delta = r
endif
loop
exitwhen r > radius
set w = SquareRoot(radius * radius - r * r)
call SetRect(t, x - r, y - w, x + r, y + w)
call RegionAddRect(whichRegion, t)
set r = r + delta
endloop
call RemoveRect(t)
set t = null
endfunction[/codes]
发现进入区域事件触发时单位坐标貌似在区域外,矩形区域也是如此………………
另外,朱朱大人的代码里
[codes=jass]call SetRect(t, x - w, y + r - 16.00, x + w, y + r + 16.00)
call RegionAddRect(whichRegion, t)
call SetRect(t, x - w, y - r - 16.00, x + w, y - r + 16.00)
call RegionAddRect(whichRegion, t)[/codes]
不是很明白,我改成了
[codes=jass]call SetRect(t, x - w, y - r , x + w, y + r)
call RegionAddRect(whichRegion, t)[/codes] |
|