calculateExperienceRemaining

Calculate the experience remaining to reach the next level.

Method calculateExperienceRemaining

Parameters:

  • level (number): The current level.

  • experience (number): The current experience points.

  • baseExperience (number): The base experience points.

  • experienceMultiplier (number): The multiplier applied per level.

Returns:

  • number: The experience remaining to reach the next level.

Example Usage:

const LevelAlgorithm = require('level-algorithm');

const levelAlgorithm = new LevelAlgorithm({
  baseExperience: 100,
  experienceMultiplier: 1.5
});

const currentLevel = 5;
const currentExperience = 350;

const experienceRemaining = levelAlgorithm.calculateExperienceRemaining(currentLevel, currentExperience);

console.log(experienceRemaining); // Output: 163.34375 (based on example parameters)

This method calculates the remaining experience required to achieve the next level based on the provided current level, current experience, base experience, and experience multiplier within the LevelAlgorithm instance.

Last updated