Projektmanagement-Game/Webservice/Hunter.js
2021-06-17 18:33:16 +02:00

19 lines
375 B
JavaScript

class Hunter {
constructor() {
this.position = 0;
}
move_by(amount) {
this.position += amount;
}
hunt(playerArray) {
for (let i = 0; i < playerArray.length; i++) {
if (playerArray[i].position <= this.position) {
playerArray[i].isAlive = false;
}
}
}
}
module.exports = Hunter;