what code will I use to check if the actor was hit 3 times and remove itself


private int hitCount;
hitCount++; if (hitCount == 3) getWorld().removeObject(this);
private int counter = 0 ; public void count(){ Actor bullet = getOneObjectAtOffset(0,0, bullet.class); if (bullet != null) { counter = counter + 1; dead(); } } public void dead(){ if (counter == 3){ getWorld().removeObject(this); } }
private int counter = 0 ; public void count(){ Actor bullet = getOneObjectAtOffset(0,0, bullet.class); if (bullet != null) { getWorld().removeObject(bullet); counter = counter + 1; dead(); } } public void dead(){ if (counter == 3){ getWorld().removeObject(this); } }