Projektmanagement-Game/Webservice/Player.js
2021-07-01 15:02:55 +02:00

19 lines
383 B
JavaScript

class Player {
constructor(name) {
this.name = name;
this.position = 0;
this.isAlive = true;
}
move_by(amount) {
if(this.position > 11){
this.position++;
}else if(this.position+amount > 11){
this.position = 12;
}else{
this.position += amount;
}
}
}
module.exports = Player;