Skip to content

Commit da708b7

Browse files
committed
num levels constant
1 parent 9856ee1 commit da708b7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/assets/js/script.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ const LEVELS = [
371371
];
372372

373373
const XP_PER_LEVEL = 45;
374-
374+
const NUM_LEVELS = 300;
375375
// Load saved level or start at 0
376376
let currentLevel = Number(localStorage.getItem("userLevel")) || 0;
377377

@@ -1347,7 +1347,7 @@ async function addExperience(amount) {
13471347
// 3. Process Level Ups one by one
13481348
// Using a while loop ensures that if you gain 100 XP,
13491349
// it processes Level 1, then Level 2, with the remainder left over.
1350-
while (currentXP >= XP_THRESHOLD && currentLevel < 200) {
1350+
while (currentXP >= XP_THRESHOLD && currentLevel < NUM_LEVELS) {
13511351
currentXP -= XP_THRESHOLD;
13521352
currentLevel++;
13531353
// 1. Trigger the Visual Toast (Top of screen)
@@ -1476,8 +1476,8 @@ function jumpToLevel() {
14761476

14771477
let targetLvl = parseInt(input.value);
14781478

1479-
// Clamp between 0 and 200
1480-
targetLvl = Math.max(0, Math.min(200, targetLvl));
1479+
// Clamp between 0 and NUM_LEVELS
1480+
targetLvl = Math.max(0, Math.min(NUM_LEVELS, targetLvl));
14811481

14821482
// Update the GLOBAL variables
14831483
currentLevel = targetLvl;

0 commit comments

Comments
 (0)