Extracted classes from server.js
This commit is contained in:
16
Webservice/Player.js
Normal file
16
Webservice/Player.js
Normal 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;
|
||||
Reference in New Issue
Block a user