Now that you've been killed, at least you know that the castle is going to be attacked by a catapult.
So maybe if you waited a while, you wouldn't be killed.
Just wait one step in front of the place where you were killed, and after a few seconds, the castle will still be attacked, only with you at a safe distance away from the impact.