Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Line of sight
#2
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
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)