Projektmanagement-Game/Webservice/Player.js

21 lines
403 B
JavaScript
Raw Normal View History

var maxField = 15;
2021-06-17 06:45:45 +00:00
class Player {
constructor(name) {
this.name = name;
2021-06-17 06:45:45 +00:00
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;
}
2021-06-17 06:45:45 +00:00
}
}
module.exports = Player;