View Single Post
Old 07-20-2007, 09:31 PM   #7
ClichesAreSt00pid
User
 
Join Date: Jan 2007
Posts: 157

ClichesAreSt00pid has little to show at this moment (4)

Default

I dunno how well this works and you might wanna make the 45 lower or higher but this should detect which direction a wall is from a X Y location so if you wanna use it to make sure a wall isn't there or you want to make it bounce off something this should help.

Also can you include the caster system funcs in the tutorial please.

Collapse JASS:
function GetCliffAngle takes real x, real y returns real
  local integer co = GetTerrainCliffLevel(x,y) //cliff origin
  local integer ce = GetTerrainCliffLevel(x+45,y) //cliff east
  local integer cn = GetTerrainCliffLevel(x,y+45) //cliff north
  local integer cw = GetTerrainCliffLevel(x-45,y) //cliff west
  local integer cs = GetTerrainCliffLevel(x,y-45) //cliff south
  if ce > co and cn <= co and cw <= co and cs <= co then //east
    return 0.
  endif
  if cn > co and ce <= co and cw <= co and cs <= co then //north
    return 90.
  endif
  if cw > co and cn <= co and ce <= co and cs <= co then //west
    return 180.
  endif
  if cs > co and cn <= co and cw <= co and ce <= co then //south
    return 270.
  endif
  return 0.
//0 = east, 90 = north, 180 = west, 270 = south
endfunction
ClichesAreSt00pid is offline   Reply With Quote