Exemplo n.º 1
0
    // tells whether two GameObjects are currently overlapping
    public bool intersects(GameObject other)
    {
        GameObject g1 = this;
        GameObject g2 = other;
        GameShape  s1 = g1.getShape();
        GameShape  s2 = g2.getShape();

        double[] offset = new double[2];
        offset[0] = g2.getCenter()[0] - g1.getCenter()[0];
        offset[1] = g2.getCenter()[1] - g1.getCenter()[1];
        return(s1.intersects(s2, offset));
    }