Projektmanagement-Game/Webservice/Player.js

17 lines
338 B
JavaScript
Raw Normal View History

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) {
2021-06-17 06:45:45 +00:00
this.position += amount;
//todo: move by 1 only on the last 3 fields
if (this.position >= 16) {
2021-06-17 06:45:45 +00:00
// todo: win
}
}
}
module.exports = Player;