From 9af752349c40be745d1296d95675916f95977890 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 21 Apr 2024 23:16:57 +0100 Subject: fix placing things on the floor --- tilemap.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tilemap.go') 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 } -- cgit v1.2.1