ELEC2645 (2016/17) / Mbed 2 deprecated 2645_Project_el15as

Dependencies:   mbed

Revision:
2:8c5c47b2372d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GameObject/GameObject.cpp	Wed Apr 19 00:44:21 2017 +0000
@@ -0,0 +1,42 @@
+#include "GameObject.h"
+
+GameObject::GameObject()
+{
+
+}
+
+GameObject::~GameObject()
+{
+
+}
+
+bool GameObject::containsPoint(int x, int y)
+{
+    if (containsY(y) == true) {
+        if (containsX(x) == true) {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool GameObject::containsX(int _x)
+{
+    for (int i = 0; i < width; i++) {
+        if ((position.x + i) == _x) {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool GameObject::containsY(int _y)
+{
+    for (int i = 0; i < height; i++) {
+        if ((position.y + i) == _y) {
+            return true;
+        }
+    }
+    return false;
+}
+