forked from robhawkes/mozilla-festival
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.js
More file actions
38 lines (32 loc) · 661 Bytes
/
Player.js
File metadata and controls
38 lines (32 loc) · 661 Bytes
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
/**************************************************
** GAME PLAYER CLASS
**************************************************/
var Player = function(startX, startY) {
var x = startX,
y = startY,
id;
// Getters and setters
var getX = function() {
return x;
};
var getY = function() {
return y;
};
var setX = function(newX) {
x = newX;
};
var setY = function(newY) {
y = newY;
};
// Define which variables and methods can be accessed
return {
getX: getX,
getY: getY,
setX: setX,
setY: setY,
id: id
}
};
// Export the Player class so you can use it in
// other files by using require("Player").Player
exports.Player = Player;