11const XP_PER_LEVEL = 45 ;
2+
3+ // XP rewards for events and secrets
4+ const XP_MOUSE_HOVER = 1 ; // Base XP for mouse interactions
5+ const XP_FORCE_SURGE_TICK = 10 ; // XP per tick during Force Surge
6+ const XP_FORCE_SURGE_TOTAL = 1000 ; // Total XP from Force Surge event
7+ const XP_MAGIC_BONUS = 50 ; // Magic XP bonus
8+ const XP_MATRIX_SECRET = 75 ; // Matrix easter egg unlock
9+ const XP_PULSE_SECRET = 180 ; // Pulse dot easter egg
10+ const XP_GRAVITY_SECRET = 250 ; // Gravity effect easter egg
11+ const XP_KONAMI_SECRET = 500 ; // Konami code easter egg
12+ const XP_FOOTER_SURGE = 1000 ; // Footer surge secret
13+ const XP_BADGE_CLICK = 45 ; // Badge click reward
14+
215const NUM_LEVELS = LEVELS . length ;
316// Load saved level or start at 0
417let currentLevel = Number ( localStorage . getItem ( "userLevel" ) ) || 0 ;
@@ -236,7 +249,7 @@ window.createFloatingXP = function (e) {
236249 // 2. Styling (Tailwind classes + Inline for positioning)
237250 popup . className =
238251 "fixed pointer-events-none z-[999] font-black text-sm tracking-tighter animate-xp-float" ;
239- popup . innerText = "+1 XP" ;
252+ popup . innerText = `+ ${ XP_MOUSE_HOVER } XP` ;
240253
241254 // 3. Get current Rank color for the "Pop"
242255 const rank = getRank ( currentLevel ) ;
@@ -250,7 +263,7 @@ window.createFloatingXP = function (e) {
250263
251264 // 5. Award XP and update that "Newbie" header
252265 if ( typeof addExperience === "function" ) {
253- addExperience ( 1 ) ;
266+ addExperience ( XP_MOUSE_HOVER ) ;
254267 }
255268
256269 // 6. Cleanup
@@ -433,9 +446,9 @@ function triggerForceSurge() {
433446 // 4. XP Logic
434447 let currentXPAdded = 0 ;
435448 const xpInt = setInterval ( ( ) => {
436- addExperience ( 10 ) ;
437- currentXPAdded += 10 ;
438- if ( currentXPAdded >= 1000 ) clearInterval ( xpInt ) ;
449+ addExperience ( XP_FORCE_SURGE_TICK ) ;
450+ currentXPAdded += XP_FORCE_SURGE_TICK ;
451+ if ( currentXPAdded >= XP_FORCE_SURGE_TOTAL ) clearInterval ( xpInt ) ;
439452 } , 50 ) ;
440453
441454 // 5. Cleanup
@@ -449,7 +462,7 @@ function triggerForceSurge() {
449462
450463function triggerMagicXP ( ) {
451464 initAudio ( ) ;
452- addExperience ( 50 ) ;
465+ addExperience ( XP_MAGIC_BONUS ) ;
453466}
454467
455468function triggerSecretUnlock ( type ) {
@@ -476,18 +489,18 @@ function triggerSecretUnlock(type) {
476489
477490 // Assign XP based on difficulty
478491 if ( type === "konami" ) {
479- addExperience ( 500 ) ; // Massive bonus for the long code
492+ addExperience ( XP_KONAMI_SECRET ) ;
480493 } else if ( type === "gravity" ) {
481- addExperience ( 250 ) ; // 1 full level
494+ addExperience ( XP_GRAVITY_SECRET ) ;
482495 } else if ( type === "pulse" ) {
483- addExperience ( 180 ) ; // 4 levels
496+ addExperience ( XP_PULSE_SECRET ) ;
484497 } else if ( type === "footer_surge" ) {
485- addExperience ( 1000 ) ; // 4 levels
498+ addExperience ( XP_FOOTER_SURGE ) ;
486499 } else if ( type === "badge_click" ) {
487- addExperience ( 45 ) ; // 4 levels
500+ addExperience ( XP_BADGE_CLICK ) ;
488501 } else {
489502 // matrix
490- addExperience ( 75 ) ; // 2 full levels
503+ addExperience ( XP_MATRIX_SECRET ) ;
491504 }
492505
493506 console . log ( `✨ Secret Unlocked: ${ eggId } ` ) ;
@@ -612,12 +625,10 @@ function activateGravityEffect() {
612625 ) ;
613626 targets . forEach ( ( el ) => {
614627 const dist = window . innerHeight + 1000 ;
615- el . style . transition = `transform ${
616- 1 + Math . random ( )
617- } s ease-in, opacity 1s`;
618- el . style . transform = `translateY(${ dist } px) rotate(${
619- Math . random ( ) * 60 - 30
620- } deg)`;
628+ el . style . transition = `transform ${ 1 + Math . random ( )
629+ } s ease-in, opacity 1s`;
630+ el . style . transform = `translateY(${ dist } px) rotate(${ Math . random ( ) * 60 - 30
631+ } deg)`;
621632 el . style . opacity = "0" ;
622633 el . style . pointerEvents = "none" ;
623634 } ) ;
@@ -726,7 +737,7 @@ function triggerBadgeLevelUp() {
726737 playSound ( "secret" ) ;
727738
728739 // Force a level up for the "first time" experience
729- addExperience ( 45 ) ; // Assuming 45 XP = 1 Level
740+ addExperience ( XP_PER_LEVEL ) ;
730741
731742 hasTriggeredFirstLevel = true ;
732743
0 commit comments