Projektmanagement-Game/Webservice/Hunter.js

19 lines
375 B
JavaScript
Raw Normal View History

2021-06-17 06:45:45 +00:00
class Hunter {
constructor() {
this.position = 0;
}
move_by(amount) {
2021-06-17 06:45:45 +00:00
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;