Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: GameObject/GameObject.cpp
- Revision:
- 4:1f7f32f3e017
- Child:
- 12:0a5758356381
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameObject/GameObject.cpp Mon Apr 24 22:32:40 2017 +0000 @@ -0,0 +1,41 @@ +#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; +} \ No newline at end of file