proc/
WalkTo(mob/c, mob/m)
while(c && m && bounds_dist(c,m)>c.step_size)
step_towards(c,m)
sleep(c.step_size/world.fps)
world<<"debugging."
So.. I tried writing my own walk_to() proc using bounds_dist to get pixel perfect accuracy yet I came up with a problem. I walk towards an enemy then attack, then back to my initial position. Then it's the enemies turn and they begin walking towards me and the code gets stuck here, constantly sending the world my debugging message. My assumption is that my formula for while() is off and when the enemy or I get to a certain bounds_dist it either keeps on running the above code, or it skips it completely.
I've tried all sorts of formulas, some work longer than others but in the end, always reach a breaking point. I'm not an expert with math, anyone think they know a formula that'll work this correctly?
Also, to simplify the condition in the while() statement you can reorganize it like this:
By writing out the checks in separate if() statements they can be less confusing.