From 1980f15a462bfc5b46204960e74927ba9545e5f3 Mon Sep 17 00:00:00 2001 From: cmclark00 Date: Sat, 29 Mar 2025 00:04:44 -0400 Subject: [PATCH] Adjust XP progression and improve animations: - Increased XP requirements and curve for slower leveling - Enhanced XP gain animations with smoother transitions - Improved visual feedback for level progression --- .../mintris/model/PlayerProgressionManager.kt | 14 +++--- .../java/com/mintris/ui/ProgressionScreen.kt | 45 +++++++++++-------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/mintris/model/PlayerProgressionManager.kt b/app/src/main/java/com/mintris/model/PlayerProgressionManager.kt index 2924d08..0ddc2a7 100644 --- a/app/src/main/java/com/mintris/model/PlayerProgressionManager.kt +++ b/app/src/main/java/com/mintris/model/PlayerProgressionManager.kt @@ -287,13 +287,13 @@ class PlayerProgressionManager(context: Context) { private const val KEY_SELECTED_BLOCK_SKIN = "selected_block_skin" // XP constants - private const val BASE_XP = 2000L - private const val XP_CURVE_FACTOR = 1.8 - private const val LEVEL_MULTIPLIER = 0.05 - private const val XP_PER_LINE = 50L - private const val TETRIS_XP_BONUS = 200L - private const val PERFECT_CLEAR_XP_BONUS = 400L - private const val TIME_XP_PER_MINUTE = 25L + private const val BASE_XP = 3000L + private const val XP_CURVE_FACTOR = 2.0 + private const val LEVEL_MULTIPLIER = 0.03 + private const val XP_PER_LINE = 40L + private const val TETRIS_XP_BONUS = 150L + private const val PERFECT_CLEAR_XP_BONUS = 300L + private const val TIME_XP_PER_MINUTE = 20L // Theme constants const val THEME_CLASSIC = "theme_classic" diff --git a/app/src/main/java/com/mintris/ui/ProgressionScreen.kt b/app/src/main/java/com/mintris/ui/ProgressionScreen.kt index bc67809..5aba75e 100644 --- a/app/src/main/java/com/mintris/ui/ProgressionScreen.kt +++ b/app/src/main/java/com/mintris/ui/ProgressionScreen.kt @@ -74,20 +74,35 @@ class ProgressionScreen @JvmOverloads constructor( playerLevelText.text = "Player Level: $playerLevel" xpGainText.text = "+$xpGained XP" - // Begin animation sequence - xpProgressBar.setXPValues(playerLevel, currentXP, xpForNextLevel) - - // Animate XP gain text entrance - val xpTextAnimator = ObjectAnimator.ofFloat(xpGainText, "alpha", 0f, 1f).apply { - duration = 500 + // Start with initial animations + AnimatorSet().apply { + // Fade in the XP gain text + val xpTextAnimator = ObjectAnimator.ofFloat(xpGainText, "alpha", 0f, 1f).apply { + duration = 800 + interpolator = AccelerateDecelerateInterpolator() + } + + // Set up the XP progress bar animation sequence + val xpBarAnimator = ObjectAnimator.ofFloat(xpProgressBar, "alpha", 0f, 1f).apply { + duration = 800 + interpolator = AccelerateDecelerateInterpolator() + } + + // Play animations in sequence + play(xpTextAnimator) + play(xpBarAnimator).after(xpTextAnimator) + start() } - // Schedule animation for the XP bar after text appears + // Set initial progress bar state + xpProgressBar.setXPValues(playerLevel, currentXP - xpGained, xpForNextLevel) + + // Animate the XP gain after a short delay postDelayed({ xpProgressBar.animateXPGain(xpGained, playerLevel, currentXP, xpForNextLevel) - }, 600) + }, 1000) // Increased delay to 1 second for better visual flow - // If there are new rewards, show them with animation + // If there are new rewards, show them with animation after XP bar animation if (newRewards.isNotEmpty()) { // Create reward cards rewardsContainer.removeAllViews() @@ -113,18 +128,12 @@ class ProgressionScreen @JvmOverloads constructor( card.animate() .alpha(1f) .translationY(0f) - .setDuration(400) - .setStartDelay((i * 150).toLong()) + .setDuration(600) // Increased duration for smoother animation + .setStartDelay((i * 200).toLong()) // Increased delay between cards .setInterpolator(OvershootInterpolator()) .start() } - }, 2000) // Wait for XP bar animation to finish - } - - // Start with initial animations - AnimatorSet().apply { - play(xpTextAnimator) - start() + }, 2500) // Increased delay to wait for XP bar animation to finish } }