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

Dependencies:   mbed

GameObject/GameObject.cpp

Committer:
el15as
Date:
2017-04-24
Revision:
4:1f7f32f3e017
Child:
12:0a5758356381

File content as of revision 4:1f7f32f3e017:

#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;
}