From fab0fccc0aaa18e915bcd08e81e5a04177e435cd Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Mon, 21 Oct 2024 19:06:58 +0200 Subject: fix quad tree collision checker --- CollisionChecker.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CollisionChecker.cpp (limited to 'CollisionChecker.cpp') diff --git a/CollisionChecker.cpp b/CollisionChecker.cpp new file mode 100644 index 0000000..b8bcbd5 --- /dev/null +++ b/CollisionChecker.cpp @@ -0,0 +1,14 @@ +#include "CollisionChecker.h" +#include "Museum.h" + +CollisionChecker::CollisionChecker(Museum & m) : museum(m) { } + +void CollisionChecker::compare(Artist & a, Artist & b) { + if (a.data.x + 0.5 < b.data.x) return; + if (a.data.y + 0.5 < b.data.y) return; + if (a.data.x > b.data.x + 0.5) return; + if (a.data.y > b.data.y + 0.5) return; + + a.colliding = b.colliding = true; +} + -- cgit v1.2.3