ID:2257161
 
(See the best response by Crazah.)
Code:
for(var/mob/Combative/target in view(0,M))
if(target!=M&&target in get_step(M,M.dir))


Problem description:
I've also tried this with:
for(var/mob/Combative/target in view(1,M))


however because of pixel movement it's not accurate and sometimes doesn't hit at all... for some people this may sound like a basic problem but I'm not exactly what you'd call a professional programmer if someone could help me figure out an effective way of having an accurate attack i'd appreciate it
Apparently you can only attack a person from north, north east and east .. .-. I've messed around with the bounds and stuff and I'm not too sure why it's being weird
You'll want to look up bounds(). It should give you exactly what you want to pixel perfection.
In response to Crazah
Crazah wrote:
You'll want to look up bounds(). It should give you exactly what you want to pixel perfection.

That helps a lot with the not working on directions side of things, I replaced the for() with this:

for(var/mob/Combative/target in bounds(M,24))


now the only problem is you can attack the mob while not even facing it and putting if(target in get_dir(M,target)) it breaks and doesn't work, any suggestions?
Best response
if(get_dir(M,target) == M.dir))
foo
Perfect :D Thanks dude I appreciate the help