fixed a bug where ActorWithBody.mouseUp is incorrectly implemented

This commit is contained in:
minjaesong
2022-07-20 17:29:10 +09:00
parent de7ef60396
commit 0f4508986d
4 changed files with 12 additions and 2 deletions

View File

@@ -580,8 +580,13 @@ open class ActorWithBody : Actor {
feetPosPoint.set(hitbox.centeredX, hitbox.endY)
feetPosTile.set(hIntTilewiseHitbox.centeredX.floorInt(), hIntTilewiseHitbox.endY.floorInt())
if (mouseUp && this.tooltipText != null) INGAME.setTooltipMessage(this.tooltipText)
}
// make sure tooltip to disable even when the actor's update is paused at unfortunate time
if (!mouseUp && INGAME.getTooltipMessage() == this.tooltipText) INGAME.setTooltipMessage(null)
isStationary = (hitbox - oldHitbox).magnitudeSquared < PHYS_EPSILON_VELO
}

View File

@@ -158,7 +158,8 @@ class Hitbox {
return this
}
fun containsPoint(x: Double, y: Double) = (hitboxStart.x - x) in 0.0..width && (hitboxStart.y - y) in 0.0..height
// TODO consider ROUNDWORLD
fun containsPoint(x: Double, y: Double) = (x - hitboxStart.x) in 0.0..width && (y - hitboxStart.y) in 0.0..height
fun containsPoint(p: Point2d) = containsPoint(p.x, p.y)