v3.2.0: fixed floating text stacking to use visual logic entirely

This commit is contained in:
Evan Debenham
2025-07-04 13:59:05 -04:00
parent bd91186934
commit 22183d8a28
2 changed files with 6 additions and 1 deletions

View File

@@ -201,8 +201,9 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
float x = destinationCenter().x; float x = destinationCenter().x;
float y = destinationCenter().y - height()/2f; float y = destinationCenter().y - height()/2f;
int pos = DungeonTilemap.worldToTile(x, y + height(), Dungeon.level.width());
if (ch != null) { if (ch != null) {
FloatingText.show( x, y, ch.pos, text, color, icon, true ); FloatingText.show( x, y, pos, text, color, icon, true );
} else { } else {
FloatingText.show( x, y, -1, text, color, icon, true ); FloatingText.show( x, y, -1, text, color, icon, true );
} }

View File

@@ -165,6 +165,10 @@ public abstract class DungeonTilemap extends Tilemap {
(pos % Dungeon.level.width() + 0.5f) * SIZE, (pos % Dungeon.level.width() + 0.5f) * SIZE,
(pos / Dungeon.level.width() + 0.1f) * SIZE ); (pos / Dungeon.level.width() + 0.1f) * SIZE );
} }
public static int worldToTile( float x, float y, int width){
return (int)(x / SIZE) + ((int)(y / SIZE) * width);
}
@Override @Override
public boolean overlapsScreenPoint( int x, int y ) { public boolean overlapsScreenPoint( int x, int y ) {