calculateExperience

Calculate the total experience required to reach a specific level.

Method calculateExperience

Parameters

  • level (number): The target level.

Returns

  • number: The total experience required for the specified level.

Example Usage

const LevelAlgorithm = require('@mr_fozan/level');

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

const targetLevel = 5;

const requiredExperience = levelAlgorithm.calculateExperience(targetLevel);

console.log(`Experience required for level ${targetLevel}: ${requiredExperience}`);

This method calculates the total experience required to achieve a specific level based on the provided base experience and experience multiplier within the LevelAlgorithm instance.

Last updated