コード例 #1
0
    public bool doesCollide(Collidable other)
    {
        //Validate
        if (other == null) return false;

        //Check
        if (getTop() < other.getBottom())	return false;
        if (getLeft() > other.getRight())	return false;
        if (getRight() < other.getLeft())	return false;
        if (getBottom() > other.getTop())	return false;

        //Otherwise, colliding
        return true;
    }