26 if (
other.getContainingLocation() != ghost.
getEntity().getContainingLocation() || !
other.isAlive()) {
30 super.advance(amount, ghost);
34 float dirToOther = Misc.getAngleInDegrees(ghost.
getEntity().getLocation(),
other.getLocation());
37 float clockwiseDir = dirToOther + 90f;
41 if (distOffset > bandRadius) distOffset = bandRadius;
42 if (distOffset < -bandRadius) distOffset = -bandRadius;
44 float angleOffset = distOffset / bandRadius * -60f;
49 if (Misc.isReversePolarity(
other)) {
50 useCircleDir = -useCircleDir;
52 if (useCircleDir == 0f) {
53 float velDir = Misc.getAngleInDegrees(ghost.
getEntity().getVelocity());
54 float angleDiffCW = Misc.getAngleDiff(dirToOther + 90f, velDir);
55 float angleDiffCCW = Misc.getAngleDiff(dirToOther - 90f, velDir);
56 if (angleDiffCW > angleDiffCCW) {
64 float moveDir = clockwiseDir;
65 if (useCircleDir > 0) {
67 angleOffset = -angleOffset;
70 moveDir += angleOffset;
71 moveDir = Misc.normalizeAngle(moveDir);
73 Vector2f dest = Misc.getUnitVectorAtDegreeAngle(moveDir);
75 Vector2f.add(dest, ghost.
getEntity().getLocation(), dest);