public void damageDetection ()
    {
        if (character.equals("P1"))
        {
            P2AttackArea getHit = (P2AttackArea)getOneIntersectingObject(P2AttackArea.class);
            if (getHit != null)
            {
                hurt = true;
                hitpoint-= getHit.damageDealt();
                if (getHit.returnForceDirection())
                    x+= getHit.dealForce();
                else
                    x-= getHit.dealForce();
            }
            else
            {
                hurt = false;
            }
        }
        else  if (character.equals("P2"))
        {
            P1AttackArea getHit = (P1AttackArea)getOneIntersectingObject(P1AttackArea.class);
            if (getHit != null)
            {
                hurt = true;
                hitpoint-= getHit.damageDealt();
                if (getHit.returnForceDirection())
                    x+= getHit.dealForce();
                else
                    x-= getHit.dealForce();
            }
            else
            {
                hurt = false;
            }
        }
    }