fix: player was drawn 1px lower than they should be

This commit is contained in:
minjaesong
2024-02-08 18:06:00 +09:00
parent 9068143239
commit afa2aef4c6
2 changed files with 3 additions and 3 deletions

View File

@@ -180,7 +180,7 @@ class AssembledSpriteAnimation(
val w = image.regionWidth * scale
val h = image.regionHeight * scale
val fposX = posX.floorToFloat() + drawPos.x * scale
val fposY = posY.floorToFloat() + drawPos.y * scale - h
val fposY = (posY - 0.5f).floorToFloat() + drawPos.y * scale - h
// draw
if (flipHorizontal && flipVertical)
@@ -205,7 +205,7 @@ class AssembledSpriteAnimation(
val w = image.regionWidth * scale
val h = image.regionHeight * scale
val fposX = posX.floorToFloat() + drawPos.x * scale
val fposY = posY.floorToFloat() + drawPos.y * scale
val fposY = (posY - 0.5f).floorToFloat() + drawPos.y * scale
if (flipHorizontal && flipVertical)
batch.draw(image, fposX + txFlp, fposY + tyFlp, -w, -h)