View Single Post
  #4  
Old May 18th, 2009, 07:25 PM

chrispedersen chrispedersen is offline
BANNED USER
 
Join Date: May 2004
Posts: 4,075
Thanks: 203
Thanked 121 Times in 91 Posts
chrispedersen is on a distinguished road
Default Re: Diagonal Distance/Range

Quote:
Originally Posted by lch View Post
It's almost the Manhattan metric. The game calculates the distance between (x0,y0) and (x1,y1) by

dx = |x0-x1|
dy = |y0-y1|

r = dx+dy

if (dx > 0 and dy > 0) --r
if (dx > 3 and dy > 3) --r
if (dx > 6 and dy > 6) --r
if (dx > 9 and dy > 9) --r
ok, I'll be the ignoramous.. I don't get the if (dx>0... etc
--r explain in english?
Reply With Quote