dropped item can be picked up (at a weird distance)

This commit is contained in:
minjaesong
2021-10-02 17:50:27 +09:00
parent 6fda6bafe4
commit f6b0b447a4
5 changed files with 51 additions and 8 deletions

View File

@@ -156,6 +156,13 @@ class Hitbox {
infix fun intersects(position: Point2d) =
(position.x >= startX && position.x <= startX + width) &&
(position.y >= startY && position.y <= startY + height)
infix fun intersects(other: Hitbox) =
(this.startX <= other.startX && other.startX <= this.endX) ||
(this.startX <= other.endX && other.endX <= this.endX) &&
(this.startY <= other.startY && other.startY <= this.endY) ||
(this.startY <= other.endY && other.endY <= this.endY)
fun toVector(): Vector2 = Vector2(startX, startY)