sorting of hitpoints and seleting closest