diff --git a/CHANGELOG.md b/CHANGELOG.md
index fefb776..c2107b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
---
+## [1.3.X] - 2020-12-XX
+
+### Changed
+- Small changes in `index.html` in example
+- Remove dependency `astar-typescript` in example
+- Add new controller in example for diagonal movement
+
+---
+
## [1.2.5] - 2020-12-13
### Fixed
diff --git a/example/index.html b/example/index.html
index 923fe26..cbaa853 100755
--- a/example/index.html
+++ b/example/index.html
@@ -1,10 +1,10 @@
-
+
-
+
astar-typescript-example
-
+
diff --git a/example/package.json b/example/package.json
index d31911c..8574489 100755
--- a/example/package.json
+++ b/example/package.json
@@ -25,7 +25,6 @@
"webpack-dev-server": "3.11.0"
},
"dependencies": {
- "astar-typescript": "1.2.4",
"phaser": "3.24.1",
"dat.gui": "0.7.7"
},
diff --git a/example/scenes/main-scene.ts b/example/scenes/main-scene.ts
index 89a97db..5e0ba1e 100755
--- a/example/scenes/main-scene.ts
+++ b/example/scenes/main-scene.ts
@@ -161,6 +161,19 @@ export class MainScene extends Phaser.Scene {
['Manhattan', 'Euclidean', 'Chebyshev', 'Octile']
);
+ this.datGuiServiceInstance.addController(
+ 'Diagonal movement',
+ this,
+ 'diagonalMovement',
+ true,
+ (value) => {
+ this.diagonalMovement = value;
+ this.aStarInstance.setDiagonalMovement(this.diagonalMovement);
+ this.destroyPathAndSurroundingNodes();
+ this.resetAStarInstance();
+ }
+ );
+
this.datGuiServiceInstance.addNumberController(
'Weight',
this,
diff --git a/example/yarn.lock b/example/yarn.lock
index fd01f4e..503be2b 100644
--- a/example/yarn.lock
+++ b/example/yarn.lock
@@ -358,13 +358,6 @@ assign-symbols@^1.0.0:
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=
-astar-typescript@1.2.4:
- version "1.2.4"
- resolved "https://registry.yarnpkg.com/astar-typescript/-/astar-typescript-1.2.4.tgz#58b287c5046ffed6f60eba154a2ce0d1d0976ea2"
- integrity sha512-XFGkklFM8tzr+oggYTa6y0xWPNXSawzDSf95hZT9Kbqfxr1OXo1Ai/yDyQZ2V708ZcYdVEZimeSvZSAAbjwG7w==
- dependencies:
- lodash "4.17.20"
-
async-each@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf"
@@ -1913,16 +1906,16 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
-lodash@4.17.20, lodash@^4.17.14, lodash@^4.17.15:
- version "4.17.20"
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
- integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
-
lodash@^4.17.11:
version "4.17.19"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
+lodash@^4.17.14, lodash@^4.17.15:
+ version "4.17.20"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
+ integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
+
loglevel@^1.6.8:
version "1.7.1"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197"
diff --git a/lib/finders/astar-finder.ts b/lib/finders/astar-finder.ts
index b758b64..3ee37ff 100644
--- a/lib/finders/astar-finder.ts
+++ b/lib/finders/astar-finder.ts
@@ -19,7 +19,7 @@ export class AStarFinder {
private openList: Node[];
// Pathway variables
- readonly diagonalAllowed: boolean;
+ private diagonalAllowed: boolean;
private heuristic: Heuristic;
readonly includeStartNode: boolean;
readonly includeEndNode: boolean;
@@ -182,6 +182,14 @@ export class AStarFinder {
this.heuristic = newHeuristic;
}
+ /**
+ * Set diagonal movement.
+ * @param diagonalMovementAllowed
+ */
+ public setDiagonalMovement(diagonalMovementAllowed: boolean): void {
+ this.diagonalAllowed = diagonalMovementAllowed;
+ }
+
/**
* Set the weight for the heuristic function.
* @param newWeight