- Joined
- Oct 15, 2019
- Messages
- 2
Hey i make a function to create a grid.. it works but at x0 or y0 it bugs out and looks like this.
and Here is my code
function CreateArena takes real StartX,real StartY, integer Wight,integer Hight returns nothing
local real x = StartX
local real y = StartY
local integer Enum = 0
local integer AnzahlAnKreisen = Wight*Hight
local integer WieOftX =0
local integer intex = 0
local integer Wightlocal = Wight
local boolean Varien =false
set Wightlocal = Wightlocal
loop
exitwhen Enum >= AnzahlAnKreisen
set Enum = Enum+1
if WieOftX >= Wightlocal then
if Varien == false then
set x = StartX -64
set y = y -128
set WieOftX = 0
set Varien = true
elseif Varien == true then
set x = StartX
set y = y -128
set WieOftX = 0
set Varien = false
endif
endif
if WieOftX < Wightlocal then
set x = x-128
set WieOftX = WieOftX+1
endif
set RectGebieteins[intex].Reci =Rect(-64,-64,64,64)
call MoveRectTo(RectGebieteins[intex].Reci,x,y)
call CreateNUnitsAtLoc( 1, 'ncop', Player(0), GetRectCenter(RectGebieteins[intex].Reci), bj_UNIT_FACING )
set intex = intex +1
endloop
endfunction
So my qustions is simpel? WHY?
and Here is my code
function CreateArena takes real StartX,real StartY, integer Wight,integer Hight returns nothing
local real x = StartX
local real y = StartY
local integer Enum = 0
local integer AnzahlAnKreisen = Wight*Hight
local integer WieOftX =0
local integer intex = 0
local integer Wightlocal = Wight
local boolean Varien =false
set Wightlocal = Wightlocal
loop
exitwhen Enum >= AnzahlAnKreisen
set Enum = Enum+1
if WieOftX >= Wightlocal then
if Varien == false then
set x = StartX -64
set y = y -128
set WieOftX = 0
set Varien = true
elseif Varien == true then
set x = StartX
set y = y -128
set WieOftX = 0
set Varien = false
endif
endif
if WieOftX < Wightlocal then
set x = x-128
set WieOftX = WieOftX+1
endif
set RectGebieteins[intex].Reci =Rect(-64,-64,64,64)
call MoveRectTo(RectGebieteins[intex].Reci,x,y)
call CreateNUnitsAtLoc( 1, 'ncop', Player(0), GetRectCenter(RectGebieteins[intex].Reci), bj_UNIT_FACING )
set intex = intex +1
endloop
endfunction
So my qustions is simpel? WHY?