-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.js
More file actions
executable file
·54 lines (45 loc) · 1.09 KB
/
Player.js
File metadata and controls
executable file
·54 lines (45 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**************************************************
** GAME PLAYER CLASS
**************************************************/
var Player = function(_id, _name, _x, _z)
{
var id = _id,
name = _name,
x = _x,
z = _z;
// Getters and setters
var getID = function() {
return id;
}
var getName = function() {
return name;
}
var getX = function() {
return x;
};
var getZ = function() {
return z;
};
var setX = function(newX) {
x = newX;
};
var setZ = function(newZ) {
z = newZ;
};
var getInfo = function() {
return { 'id': id, 'name': name, 'x': x, 'z': z };
}
// Define which variables and methods can be accessed
return {
getID: getID,
getName: getName,
getX: getX,
getZ: getZ,
setX: setX,
setZ: setZ,
getInfo: getInfo
}
};
// Export the Player class so you can use it in
// other files by using require("Player").Player
exports.Player = Player;