v2.3.0: added a cap of 5 floating texts at a time per tile

This commit is contained in:
Evan Debenham
2023-12-04 17:14:02 -05:00
parent 34b5035e75
commit 8884773783

View File

@@ -91,7 +91,7 @@ public class FloatingText extends RenderedTextBlock {
public void update() {
super.update();
if (timeLeft > 0) {
if (timeLeft >= 0) {
if ((timeLeft -= Game.elapsed) <= 0) {
kill();
} else {
@@ -218,10 +218,16 @@ public class FloatingText extends RenderedTextBlock {
if (stack.size() > 0) {
FloatingText below = txt;
int aboveIndex = stack.size() - 1;
int numBelow = 0;
while (aboveIndex >= 0) {
numBelow++;
FloatingText above = stack.get(aboveIndex);
if (above.bottom() + 4 > below.top()) {
above.setPos(above.left(), below.top() - above.height() - 4);
//reduce remaining time on texts being nudged up, to prevent spam
above.timeLeft = Math.min(above.timeLeft, LIFESPAN-(numBelow/5f));
above.timeLeft = Math.max(above.timeLeft, 0);
below = above;
aboveIndex--;