Do you also have occasional diarrhea, constipation, changed stool color?
Bloating is because normal intestinal bacteria produce gas. These bacteria may overgrow in the small intestine, due to slowed peristalsis, or in the colon, due to fats, which were not absorbed in the small intestine (e.g. due to intestinal inflammation) and thus come into the colon, where bacteria eat them and produce gas.
To say more, it would be nice to hear some other symptoms you might have (had), also medications, or chronic diseases...
Go to the emergency room they have to treat you. My daughter had similar pain and
it was very bad. Please Please Please go to the nearest er immediately