Skip to content

Commit

Permalink
Bug Fixes and Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
oklemenz committed Jun 22, 2021
1 parent bd3eaa2 commit 25b52b1
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 157 deletions.
147 changes: 84 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
},
"homepage": "https://github.com/oklemenz/PrinceJS#readme",
"devDependencies": {
"eslint": "^7.19.0",
"eslint": "^7.29.0",
"eslint-config": "^0.3.0",
"eslint-config-prettier": "^6.14.0",
"eslint-config-prettier": "^8.3.0",
"http-server": "^0.12.3",
"prettier": "^2.2.1",
"prettier": "^2.3.1",
"xml2json": "^0.12.0"
}
}
10 changes: 8 additions & 2 deletions src/Enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ PrinceJS.Enemy.prototype.updateActor = function () {
this.checkRoomChange();
this.updateCharPosition();
this.updateSwordPosition();
this.maskAndCrop();
};

PrinceJS.Enemy.prototype.CMD_TAP = function (data) {
Expand All @@ -81,7 +82,7 @@ PrinceJS.Enemy.prototype.CMD_TAP = function (data) {
};

PrinceJS.Enemy.prototype.updateBehaviour = function () {
if (this.opponent == null || !this.alive) {
if (this.opponent === null || !this.alive) {
return;
}
if (!this.opponent.alive) {
Expand Down Expand Up @@ -147,9 +148,14 @@ PrinceJS.Enemy.prototype.enemyAdvance = function () {
return;
}

let tile = this.level.getTileAt(this.charBlockX, this.charBlockY, this.room);
if (tile.isSpace()) {
this.startFall();
return;
}

let tileF = this.level.getTileAt(this.charBlockX + this.charFace, this.charBlockY, this.room);
let tileR = this.level.getTileAt(this.charBlockX - this.charFace, this.charBlockY, this.room);

if (tileF.isSafeWalkable()) {
this.advance();
} else {
Expand Down
Loading

0 comments on commit 25b52b1

Please sign in to comment.