|
123456789101112131415161718192021222324252627 |
- (function() {
- window.Game = function(canvas, players, index) {
- this._canvas = canvas;
- this._ctx = canvas.getContext("2d");
- this._players = players;
- this._player = players[index];
- this._sock = sock;
-
- this._keys = [];
-
- //Keep track of which keys are pressed and which aren't
- canvas.addEventListener("keydown", function(evt) {
- this._keys[evt.keyCode] = true;
- }.bind(this));
- canvas.addEventListener("keyup", function(evt) {
- this._keys[evt.keyCode] = false;
- }.bind(this));
- }
-
- Game.prototype.start = function() {
- console.log("starting game");
- }
-
- Game.prototype.stop = function() {
- console.log("Stopping game");
- }
- })();
|