How the sacrifice works



That's called hanging a piece, and against an intermediate player you will lose. I prefer 8.Bxe2 but even after 8.Kxe2 White has a clear path to victory. The right to castle (especially with the queen off-board, and no immediate tactical follow-up) is simply not worth the 2.25 pawns you gave up to take it away.

Below is the Cochrane Gambit, an example of an often-successful piece sacrifice. A couple differences: (1) White wins two pawns for the piece and (2) the queens are still on-board which makes Black's uncastled position more precarious.
I'm not sure if 'boxing' up the king is really worth the piece in this case. First of all the king is not that boxed up at all and second Black doesn't have a direct line of attack. And that's assuming that white captures with the king in stead of the bishop (as mentioned above). Maybe someone can put this in a chess analysis program and see how you score (I don't have one ), But I guess your down at least two points. Maybe you can show the rest of the game, so we can see how you took advantage of this sacrifice...

This is a game played by me recently and thought i'd give you an example of a sacrifice