diff options
author | davidovski <david@davidovski.xyz> | 2024-04-21 23:16:57 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2024-04-21 23:16:57 +0100 |
commit | 9af752349c40be745d1296d95675916f95977890 (patch) | |
tree | 326f087188c7885c0c070f656d21483a30f20680 /tilemap.go | |
parent | cffac12303402c3bfd2d7eb8ab982bdaa86bd72d (diff) |
fix placing things on the floor
Diffstat (limited to 'tilemap.go')
-rw-r--r-- | tilemap.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 } |