Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/rogue/world/pathfinding/DiagonalHeuristic.java

14 lines
288 B

package mightypork.rogue.world.pathfinding;
import mightypork.rogue.world.Coord;
public class DiagonalHeuristic extends Heuristic {
@Override
public double getCost(Coord pos, Coord target)
{
return Math.sqrt(Math.pow(pos.x - target.x, 2) + Math.pow(pos.y - target.y, 2));
}
}