I am wondering specifically what you did wrong? There is no law against car punching. If you and the car were in the cross-walk at the same time, the car is breaking the law and you are in danger. You slapped/punched the car to make them aware of your presecence.
I punched a car in the gas filler door and it cracked and part of it fell to the street, it was plastic.
I will say that I give cars the benefit of the doubt if it is dark, a blind intersection, or for some other good reason they would not see me. I try to make eye contact whenever I run in front of car, so I know they have seen me.