Pre-release
AdventureJS Docs Downloads Bundler Devlog Score: 0 Moves: 0
// movePlayerTo.js

(function () {
  /* global AdventureJS A */

  var p = AdventureJS.Game.prototype;

  /**
   * <strong>movePlayerTo</strong> takes a string representing an
   * asset name or id and tries to move the player there.
   * @memberOf AdventureJS.Game
   * @method AdventureJS.Game#move
   * @param {Object|String} asset Asset object or Name or ID of a game object.
   * @returns {Object} A game asset.
   */
  p.movePlayerTo = function Game_movePlayerTo(asset) {
    if ("string" === typeof asset) {
      asset = this.game.getAsset(asset);
    }
    if (!asset) return false;
    this.game.getPlayer().moveTo(null, asset);
  };
})();