Skip to content

Commit

Permalink
Minor Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oklemenz committed Jul 2, 2021
1 parent bc09d0a commit 50e2d4c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"eslint-config": "^0.3.0",
"eslint-config-prettier": "^8.3.0",
"http-server": "^0.12.3",
"prettier": "^2.3.1",
"prettier": "^2.3.2",
"xml2json": "^0.12.0"
}
}
4 changes: 4 additions & 0 deletions src/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ PrinceJS.Game.prototype = {
}
},

recheckCurrentRoom: function () {
this.checkForOpponent(this.currentCameraRoom);
},

checkForOpponent: function (room) {
let currentEnemy;
// Same Room / Same BlockY
Expand Down
8 changes: 7 additions & 1 deletion src/Kid.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ PrinceJS.Kid.prototype.updateBehaviour = function () {
} else if (this.frameID(142) && tile.element === PrinceJS.Level.TILE_SPACE) {
this.startFall();
}
if ((this.action === "climbup" && this.frameID(142)) || (this.action === "climbdown" && this.frameID(140))) {
this.level.recheckCurrentRoom();
}
break;
}
};
Expand Down Expand Up @@ -905,7 +908,9 @@ PrinceJS.Kid.prototype.checkFloor = function () {

PrinceJS.Kid.prototype.checkRoomChange = function () {
// Ignore frames around alternating chx (+/-)
if ([16, 17, 27, 28, 47, 48, 61, 62, 76, 77, 103, 104, 116, 117, 125, 126, 127, 128, 157].includes(this.charFrame)) {
if (
[16, 17, 27, 28, 47, 48, 61, 62, 76, 77, 103, 104, 105, 116, 117, 125, 126, 127, 128, 157].includes(this.charFrame)
) {
return;
}
let footX = this.charX + this.charFdx * this.charFace;
Expand Down Expand Up @@ -1224,6 +1229,7 @@ PrinceJS.Kid.prototype.land = function () {
this.processCommand();
this.level.unMaskTile(this);
PrinceJS.danger = false;
this.level.recheckCurrentRoom();
};

PrinceJS.Kid.prototype.crawl = function () {
Expand Down
4 changes: 4 additions & 0 deletions src/Level.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ PrinceJS.Level.prototype = {
}
}
return gates;
},

recheckCurrentRoom: function () {
this.delegate.recheckCurrentRoom();
}
};

Expand Down

0 comments on commit 50e2d4c

Please sign in to comment.