summaryrefslogtreecommitdiff
path: root/tilemap.go
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-21 23:16:57 +0100
committerdavidovski <david@davidovski.xyz>2024-04-21 23:16:57 +0100
commit9af752349c40be745d1296d95675916f95977890 (patch)
tree326f087188c7885c0c070f656d21483a30f20680 /tilemap.go
parentcffac12303402c3bfd2d7eb8ab982bdaa86bd72d (diff)
fix placing things on the floor
Diffstat (limited to 'tilemap.go')
-rw-r--r--tilemap.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tilemap.go b/tilemap.go
index 0bdb401..23120fb 100644
--- a/tilemap.go
+++ b/tilemap.go
@@ -90,7 +90,7 @@ func (tm * Tilemap) CalculateCollisions() {
func Collide(r1 image.Rectangle, r2 image.Rectangle) bool {
- return ! ( r2.Min.X > r1.Max.X || r2.Max.X < r1.Min.X || r2.Min.Y > r1.Max.Y || r2.Max.Y < r1.Min.Y)
+ return ! ( r2.Min.X >= r1.Max.X || r2.Max.X <= r1.Min.X || r2.Min.Y >= r1.Max.Y || r2.Max.Y <= r1.Min.Y)
}
func (t * Tilemap) Collide(x, y, width, height int) bool {
@@ -102,7 +102,7 @@ func (t * Tilemap) Collide(x, y, width, height int) bool {
)
for _, r2 := range t.collisions {
- if ! ( r2.Min.X > r1.Max.X || r2.Max.X < r1.Min.X || r2.Min.Y > r1.Max.Y || r2.Max.Y < r1.Min.Y) {
+ if ! ( r2.Min.X >= r1.Max.X || r2.Max.X <= r1.Min.X || r2.Min.Y >= r1.Max.Y || r2.Max.Y <= r1.Min.Y) {
return true
}