mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 10:35:21 +01:00
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
This commit is contained in:
parent
c6a4339931
commit
1980f15a46
2 changed files with 34 additions and 25 deletions
|
@ -287,13 +287,13 @@ class PlayerProgressionManager(context: Context) {
|
||||||
private const val KEY_SELECTED_BLOCK_SKIN = "selected_block_skin"
|
private const val KEY_SELECTED_BLOCK_SKIN = "selected_block_skin"
|
||||||
|
|
||||||
// XP constants
|
// XP constants
|
||||||
private const val BASE_XP = 2000L
|
private const val BASE_XP = 3000L
|
||||||
private const val XP_CURVE_FACTOR = 1.8
|
private const val XP_CURVE_FACTOR = 2.0
|
||||||
private const val LEVEL_MULTIPLIER = 0.05
|
private const val LEVEL_MULTIPLIER = 0.03
|
||||||
private const val XP_PER_LINE = 50L
|
private const val XP_PER_LINE = 40L
|
||||||
private const val TETRIS_XP_BONUS = 200L
|
private const val TETRIS_XP_BONUS = 150L
|
||||||
private const val PERFECT_CLEAR_XP_BONUS = 400L
|
private const val PERFECT_CLEAR_XP_BONUS = 300L
|
||||||
private const val TIME_XP_PER_MINUTE = 25L
|
private const val TIME_XP_PER_MINUTE = 20L
|
||||||
|
|
||||||
// Theme constants
|
// Theme constants
|
||||||
const val THEME_CLASSIC = "theme_classic"
|
const val THEME_CLASSIC = "theme_classic"
|
||||||
|
|
|
@ -74,20 +74,35 @@ class ProgressionScreen @JvmOverloads constructor(
|
||||||
playerLevelText.text = "Player Level: $playerLevel"
|
playerLevelText.text = "Player Level: $playerLevel"
|
||||||
xpGainText.text = "+$xpGained XP"
|
xpGainText.text = "+$xpGained XP"
|
||||||
|
|
||||||
// Begin animation sequence
|
// Start with initial animations
|
||||||
xpProgressBar.setXPValues(playerLevel, currentXP, xpForNextLevel)
|
AnimatorSet().apply {
|
||||||
|
// Fade in the XP gain text
|
||||||
|
val xpTextAnimator = ObjectAnimator.ofFloat(xpGainText, "alpha", 0f, 1f).apply {
|
||||||
|
duration = 800
|
||||||
|
interpolator = AccelerateDecelerateInterpolator()
|
||||||
|
}
|
||||||
|
|
||||||
// Animate XP gain text entrance
|
// Set up the XP progress bar animation sequence
|
||||||
val xpTextAnimator = ObjectAnimator.ofFloat(xpGainText, "alpha", 0f, 1f).apply {
|
val xpBarAnimator = ObjectAnimator.ofFloat(xpProgressBar, "alpha", 0f, 1f).apply {
|
||||||
duration = 500
|
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({
|
postDelayed({
|
||||||
xpProgressBar.animateXPGain(xpGained, playerLevel, currentXP, xpForNextLevel)
|
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()) {
|
if (newRewards.isNotEmpty()) {
|
||||||
// Create reward cards
|
// Create reward cards
|
||||||
rewardsContainer.removeAllViews()
|
rewardsContainer.removeAllViews()
|
||||||
|
@ -113,18 +128,12 @@ class ProgressionScreen @JvmOverloads constructor(
|
||||||
card.animate()
|
card.animate()
|
||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
.translationY(0f)
|
.translationY(0f)
|
||||||
.setDuration(400)
|
.setDuration(600) // Increased duration for smoother animation
|
||||||
.setStartDelay((i * 150).toLong())
|
.setStartDelay((i * 200).toLong()) // Increased delay between cards
|
||||||
.setInterpolator(OvershootInterpolator())
|
.setInterpolator(OvershootInterpolator())
|
||||||
.start()
|
.start()
|
||||||
}
|
}
|
||||||
}, 2000) // Wait for XP bar animation to finish
|
}, 2500) // Increased delay to wait for XP bar animation to finish
|
||||||
}
|
|
||||||
|
|
||||||
// Start with initial animations
|
|
||||||
AnimatorSet().apply {
|
|
||||||
play(xpTextAnimator)
|
|
||||||
start()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue