Chris Pratt went from the lovable, pudgy Andy Dwyer on "Parks and Recreation" to the incredibly buff Peter Quill on "Guardians of the Galaxy" in what seemed like overnight. But the new action star says he had a very real struggle with his health before he finally decided to do something about it.

"I'd gone back and forth, lost weight for 'Moneyball,' got fat again, then trimmed down for 'Zero Dark Thirty,' then gained it all back again for Andy," Pratt recalls to Men's Health UK. "That's when I saw 'Zero Dark Thirty' and right after walking out I was like: 'I'm going to get in shape and I'm never going to be fat again.'"

PHOTOS: Shocking Celebrity Weight Loss Transformations

The 35-year-old actor says that his unhealthy habits definitely had an impact on his quality of life. "I was impotent, fatigued, emotionally depressed," Pratt admits. "I had real health issues that were affecting me in a major way. It's bad for your heart, your skin, your system, your spirit."

So how bad was it? Pratt says he was weighed in at 300 pounds two years ago and would eat three to four hamburgers at every "Parks and Rec" table read.

WATCH: Chris Pratt and Melissa McCarthy Reveal the Headshots They Never Wanted You to See

"I saw myself in an episode and in the matter of two moments very close together, I thought, 'Oh my God, I'm getting fat,'" he says. "And then almost immediately I did something else and I thought, 'Holy crap, I've never seen myself funnier.' And I put the two together."

Pratt credits his image overhaul to exercise and an extreme change in diet, one that he says affected his marriage to Anna Faris.

NEWS: Chris Pratt Drinks a Bottle of Whiskey and Gives Horrible Acting Advice

"We were drinking a lot of wine and having fun. I was her little Hansel out in the woods and she was fattening me up to put me in the fire," he said of his relationship with his wife, whom he married in 2009. "It was like Momma Bear and Papa Bear. She would eat a little bit, I would eat all of mine and the rest of hers."

Pratt's new body has done him good so far! He's currently promoting his upcoming blockbuster, "Jurassic World," out June 12.

Watch: Chris Pratt makes good on Super Bowl bet