range check for fixtures with UI; fixture UI is centred now

This commit is contained in:
minjaesong
2021-12-05 14:42:36 +09:00
parent 6c62d1e2ae
commit e56ea0dc5c
4 changed files with 22 additions and 11 deletions

View File

@@ -323,6 +323,11 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
}
}
}
/**
* @param actor actor to check the reach
* @param action returns true if the action was successfully performed
*/
fun inInteractableRange(actor: ActorWithBody, action: () -> Boolean): Boolean {
val mousePos1 = Vector2(Terrarum.mouseX, Terrarum.mouseY)
val mousePos2 = Vector2(Terrarum.mouseX + INGAME.world.width * TILE_SIZED, Terrarum.mouseY)