Found this tutorial in gamingw( to lazy to make my own right now)
Let's begin by adding a fork statement for when the guard FACES UP.
<>FORN Optn:thisEvent-Up Face Direct
Since the guard can only see in a straight line, the hero's X coordinate must be equal to the Guard's X coordinate for the guard to see him:
Notice the same X Coordinates? OK, so add another fork statement that executes when "HeroX" is equal to "WatchX." Make sure that this fork statement is inside the FaceUp FORK statement!
If the guard is facing up, then he can't see what's below him, right? That means that the Hero's Y coordinate must be smakker than the guard's Y coordinate (remember that Y becomes smaller as you go up). Therefore, let's add another fork statement that detects if the "HeroY" variable is less than "GuardY".
Now, inside all those supa-dupa FORK statements, add the "stuff"(tm) that you want to execute when the guard sees you. For example:
Anyway, do the same for when the guard is facing Left, Right, and Down. Just remember:
FACE DOWN: HeroX must equal WatchX, HeroY must be greater than WatchY
FACE LEFT: HeroX must be less than WatchX, HeroY must equal WatchY
FACE LEFT: HeroX must be greater than WatchX, HeroY must equal WatchY
Now, try this program. It should work...except for one little thing: You can't hide from that blasted Sen...uh...guard! So how do you fix this? Simple! We'll need to add more code inside the fork statements!
Let us look at the mountain in the middle - the stuff that you are supposed to hide behind. It starts at (9,5) and ends at (12,10). Hmm...maybe we could add more fork statements inside the existing fork statements that detect if the watcher's vision is blocked by the mountains...it just might work, right?
Let's go back to the "Facing Up" code, inside the three nested FORK statements. If the watcher's vision is blocked by the mountains, then his Y coordinate should be greater than 10 (meaning that he's below the mountains), and the hero's Y coordinate should be below 5 (meaning that the heor is above the mountains). Let's add two fork statements to express this:
<>FORN Optn:Varbl[0002:HeroY]-5less
<>FORN Optn:Varbl[0004:WatchY]-10abov
The watcher's X coordinate (and the Hero's) should also be between 9 and 12, the X coordinates for the beginning and end of the mountain. Let's add another two FORK statements for this condition (remember that inside this look, the hero's X coordinats is equal to the Guard's X coordinate. Thus, you only need to compare one of them.)
I'll wait...Done? Good! Now, remember our good old switch, "Blocked"? Turn the switch ON inside the nested fork statements, which will tell us that Sen...uh...the guard cannot see the hero - his vision is blocked by the mountains.
After these four inner FORK statements, add another FORK statement that activates when the "Blocked" switch is OFF. Put the [guard battle code/stuff that you want to do when the guard sees the hero] in here.
Repeat this procedure for the other three directions. Just make sure to adjust the FORK statements appropriately.