public/js-roguelike-skeleton/src/player.js
function(action) {
            // if the action is a direction
            if(RL.Util.DIRECTIONS_4.indexOf(action) !== -1){
                var offsetCoord = RL.Util.getOffsetCoordsFromDirection(action),
                    moveToX = this.x + offsetCoord.x,
                    moveToY = this.y + offsetCoord.y;
                return this.move(moveToX, moveToY);
            }

            if(action === 'wait'){
                this.wait();
                return true;
            }

            return false;
        }
function(action) {
            // if the action is a direction
            if(RL.Util.DIRECTIONS_4.indexOf(action) !== -1){
                var offsetCoord = RL.Util.getOffsetCoordsFromDirection(action),
                    moveToX = this.x + offsetCoord.x,
                    moveToY = this.y + offsetCoord.y;
                return this.move(moveToX, moveToY);
            }

            if(action === 'wait'){
                this.wait();
                return true;
            }

            return false;
        }
function ( action ) { // if the action is a direction if ( RL . Util . DIRECTIONS_4 . indexOf ( action ) !== - 1 ) { var offsetCoord = RL . Util . getOffsetCoordsFromDirection ( action ) , moveToX = this . x + offsetCoord . x , moveToY = this . y + offsetCoord . y ; return this . move ( moveToX , moveToY ) ; } if ( action === 'wait' ) { this . wait ( ) ; return true ; } return false ; }
Called when user key is pressed with action of key pressed as an arg.
@method update
@param {String} action - action bound to key pressed by user
@return {Bool} true if action was taken.
Called when user key is pressed with action of key pressed as an arg .