HexaNitro

Tower Coordinate Generator

Sep 27th, 2016
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. startLvl = 0
  2. baseRad = 68
  3. maxLvl = 165
  4. coord = {...}
  5.  
  6. --iterate through each level, determining the radius each time
  7. for level = startLvl, maxLvl do
  8.     rad = math.floor((0.0019 * level ^ 2 - 0.4798 * level + baseRad) + 0.5) --rounded approximate for veil geometry (vertical projection)
  9.     --create array of coordinates where each block is to be placed
  10.     i = 1
  11.     for x = -rad, rad do
  12.         for y = -rad, rad do
  13.             if math.floor (math.sqrt(x ^ 2 + y ^ 2) + 0.5) = rad then
  14.                 coord [i][1] = x
  15.                 coord [i][2] = y
  16.                 i = i + 1
  17.             end
  18.         end
  19.     end
  20.    
  21.     --determine number of blocks needed for this level
  22.     blocks = table.getn(coord)
  23.  
  24.     --[ADD BLOCK PLACEMENT CODE HERE]
  25.  
  26. end
RAW Paste Data