Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// isWithinYRange.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Tangible.prototype;
  /**
   * Determine whether this asset's y position is within another asset's
   * y range, aka its height from its y position.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#isWithinYRange
   * @param {Object} asset
   * @returns {Boolean}
   */
  p.isWithinYRange = function Tangible_isWithinPositionYRange(asset) {
    if (!asset) return false;
    var range = asset.getYRange();
    return this.position.y >= range.min && this.position.y <= range.max;
  };
})();