Well here's the way I've come to know:
If it's in self defence or necessary for some reason, I'm sure God understands. He's not happy, but he understands. Asking for forgiveness is probably a givin.
I don't know if anyone says this, but my view is also that He wouldn't be all too happy about it if you werent at least a little sorry.
So basically, if presented with that situation [and I certainly hope not], ask forgiveness and, I think, you will go to heaven.
If anyone has any other ideas, please state, because I'm frankly not sure either. O.o