private Rectangle calculatePixelPerfect(VGDLSprite sprite1, VGDLSprite sprite2)
    {
        Vector2d sprite1v = new Vector2d(sprite1.rect.getCenterX() - sprite1.lastrect.getCenterX(),
                sprite1.rect.getCenterY() - sprite1.lastrect.getCenterY());

        sprite1v.normalise();
        Direction sprite1Dir = new Direction(sprite1v.x, sprite1v.y);

        if(sprite1Dir.equals(Types.DDOWN))
        {
            int overlay = (sprite1.rect.y + sprite1.rect.height) - sprite2.rect.y;
            return new Rectangle(sprite1.rect.x, sprite1.rect.y - overlay,
                    sprite1.rect.width, sprite1.rect.height);
        }
        else if(sprite1Dir.equals(Types.DRIGHT))
        {
            int overlay = (sprite1.rect.x + sprite1.rect.width) - sprite2.rect.x;
            return new Rectangle(sprite1.rect.x - overlay, sprite1.rect.y,
                    sprite1.rect.width, sprite1.rect.height);
        }
        else if(sprite1Dir.equals(Types.DUP))
        {
            return new Rectangle(sprite1.rect.x, sprite2.rect.y + sprite2.rect.height,
                    sprite1.rect.width, sprite1.rect.height);
        }
        else if(sprite1Dir.equals(Types.DLEFT))
        {
            return new Rectangle(sprite2.rect.x + sprite2.rect.width, sprite1.rect.y,
                    sprite1.rect.width, sprite1.rect.height);
        }


        return sprite1.lastrect;

    }