02-20-2012, 02:32 AM
slenkar Wrote:It occurs to me you can speed this up, if you quit checking as soon as you know they can't see by exiting the loop:
Code:Dim can_see:UByte
can_see=1
for x=0 to dist
if wall_in_way(bresx(x),bresy(x)) then
can_see=0
EXIT FOR ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Jump out here.
end if
next
if can_see =1 then
'yes they can see each other
end if
if can_see =0 then
'no they can not see each other
end if