Skip to content

Commit

Permalink
update comments in localnetplayer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 7, 2015
1 parent d55a917 commit ce5ce82
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions public/hft/0.x.x/scripts/localnetplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@ define(function() {
* It also provides a sendEvent method you can use to trigger
* events in your game as though they were from the controller.
*
* @constructor
* @alias LocalNetPlayer
* @example
* if (!globals.haveServer) {
* // We're testing locally so just manually create a
* // player.
* if (!globals.haveServer) {
* // We're testing locally so just manually create a
* // player.
*
* var localNetPlayer1 = new LocalNetPlayer();
* var player1 = new MyPlayer(localNetPlayer1);
* addPlayer(player1);
*
* var localNetPlayer1 = new LocalNetPlayer();
* var player1 = new MyPlayer(localNetPlayer1);
* addPlayer(player1);
* // pretend player1 one got a message from the
* // controller when any key is pressed
*
* // pretend player1 one got a message from the
* // controller when any key is pressed
* window.addEventListner('keypress', function() {
* localNetPlayer1.sendEvent('jump', { power: 10 });
* });
*
* window.addEventListner('keypress', function() {
* localNetPlayer1.sendEvent('jump', { power: 10 });
* });
* } else {
*
* } else {
* // We're online so create players as they connect.
* var server = new GameServer(...);
* server.addEventListener(
* 'playerconnect',
* function(netPlayer) {
* addPlayer(new MyPlayer(netPlayer));
* });
*
* // We're online so create players as they connect.
* var server = new GameServer(...);
* server.addEventListener(
* 'playerconnect',
* function(netPlayer) {
* addPlayer(new MyPlayer(netPlayer));
* });
* @constructor
* @alias LocalNetPlayer
*/
var LocalNetPlayer = (function() {
var _count = 0;
Expand All @@ -81,21 +81,21 @@ define(function() {
}());

/**
* @see NetPlayer.addEventListener
* see {@link NetPlayer.addEventListener}
*/
LocalNetPlayer.prototype.addEventListener = function(eventType, handler) {
this.eventHandlers[eventType] = handler;
};

/**
* @see NetPlayer.removeEventListener
* see {@link NetPlayer.removeEventListener}
*/
LocalNetPlayer.prototype.removeEventListener = function(eventType) {
this.eventHandlers[eventType] = undefined;
};

/**
* @see NetPlayer.removeAllListeners
* see {@link NetPlayer.removeAllListeners}
*/
LocalNetPlayer.prototype.removeAllListeners = function() {
this.eventHanders = { };
Expand Down

0 comments on commit ce5ce82

Please sign in to comment.