Extracted classes from server.js

This commit is contained in:
2021-06-17 08:45:45 +02:00
parent b87080c20a
commit 53d6809baa
4 changed files with 73 additions and 64 deletions

16
Webservice/Player.js Normal file
View File

@@ -0,0 +1,16 @@
class Player {
constructor(socketUsername) {
this.socketUsername = socketUsername;
this.position = 0;
this.isAlive = true;
}
move(amount) {
this.position += amount;
if (this.position === 15) {
// todo: win
}
}
}
module.exports = Player;