ID:267356
 
Is there a way to make a "step_to()" proc that would only allow non-diagonal directions?

Thanks in advanced.
Unknown Person wrote:
Is there a way to make a "step_to()" proc that would only allow non-diagonal directions?

Thanks in advanced.

You'll have to use Deadron's PathFinding library for this, I think. You can customize procs in it to allow only cardinal-direction movement.

Just for quick reference, you can tell a direction is diagonal like this:
if(dir & (dir-1))
world << "Direction is diagonal!"

if(!(dir & (dir-1)))
world << "Direction is not diagonal!"

Lummox JR