public/js-roguelike-skeleton/src/player.js
function(x, y){
            if(this.canMoveTo(x, y)){
                this.moveTo(x, y);
                return true;
            } else {
                // entity occupying target tile (if any)
                var targetTileEnt = this.game.entityManager.get(x, y);
                // if already occupied
                if(targetTileEnt){
                    this.game.console.log('Excuse me <strong>Mr.' + targetTileEnt.name + '</strong>, you appear to be in the way.');
                    return targetTileEnt.bump(this);
                } else {
                    // targeted tile (attempting to move into)
                    var targetTile = this.game.map.get(x, y);
                    return targetTile.bump(this);
                }
            }
            return false;
        }
function(x, y){
            if(this.canMoveTo(x, y)){
                this.moveTo(x, y);
                return true;
            } else {
                // entity occupying target tile (if any)
                var targetTileEnt = this.game.entityManager.get(x, y);
                // if already occupied
                if(targetTileEnt){
                    this.game.console.log('Excuse me <strong>Mr.' + targetTileEnt.name + '</strong>, you appear to be in the way.');
                    return targetTileEnt.bump(this);
                } else {
                    // targeted tile (attempting to move into)
                    var targetTile = this.game.map.get(x, y);
                    return targetTile.bump(this);
                }
            }
            return false;
        }
function ( x , y ) { if ( this . canMoveTo ( x , y ) ) { this . moveTo ( x , y ) ; return true ; } else { // entity occupying target tile (if any) var targetTileEnt = this . game . entityManager . get ( x , y ) ; // if already occupied if ( targetTileEnt ) { this . game . console . log ( 'Excuse me <strong>Mr.' + targetTileEnt . name + '</strong>, you appear to be in the way.' ) ; return targetTileEnt . bump ( this ) ; } else { // targeted tile (attempting to move into) var targetTile = this . game . map . get ( x , y ) ; return targetTile . bump ( this ) ; } } return false ; }
Move action.
@method move
@param {Number} x - Map tile cood to move to.
@param {Number} y - Map tile cood to move to.
@return {Bool} true if action was taken.
Move action .