Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Commit

Permalink
Improved flocking behavior to reduce formation of long lines of settl…
Browse files Browse the repository at this point in the history
…ers.
  • Loading branch information
andreas-eberle committed Apr 26, 2015
1 parent 99ef805 commit 4399793
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jsettlers.logic/src/jsettlers/logic/movable/Movable.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,10 @@ private int doingNothingAction() {
*/
private boolean flockToDecentralize() {
ShortPoint2D decentVector = grid.calcDecentralizeVector(position.x, position.y);
int dx = direction.gridDeltaX + decentVector.x;
int dy = direction.gridDeltaY + decentVector.y;

EDirection randomDirection = direction.getNeighbor(RandomSingleton.getInt(-1, 1));
int dx = randomDirection.gridDeltaX + decentVector.x;
int dy = randomDirection.gridDeltaY + decentVector.y;

if (ShortPoint2D.getOnGridDist(dx, dy) >= 2) {
flockDelay = Math.max(flockDelay - 100, 500);
Expand Down

0 comments on commit 4399793

Please sign in to comment.