I am trying to make an enemy for my game that attacks only in a straight line directions and includes the truest northeast southeast southwest and northwest directions. I made a little picture to explain how I'm trying to make it work.
M = Mob
T = Target Spot, Use ability if enemy is in T location.
X = False Do use ability if the enemy is in X location.
T X X X T X X X T
X T X X T X X T X
X X T X T X T X X
X X X T T T X X X
T T T T M T T T T
X X X T T T X X X
X X T X T X T X X
X T X X T X X T X
T X X X T X X X T
My head hurts from thinking about this a little too much and would appreciate some insight on how to go on about this. Thanks in advance!
The target is in a cardinal direction if get_dir(M, target) is a cardinal direction, d & (d - 1) == 0, or either dx or dy are zero.