Seth MacFarlane and his writers name their 5 most offensive jokes

The new movie “A Million Ways to Die in the West” promises to be a bit different from the typical Hollywood Western. For one, John Wayne never made shadow puppets simulate a sex act. For another, cowboys usually avail themselves of the outhouse, not their hats.

But the guys behind the comedy, opening Friday, have made a living off pushing boundaries. Co-writers Alec Sulkin, Wellesley Wild and Seth MacFarlane (who also stars and directs) are responsible for TV’s “Family Guy,” as well as the 2012 smash “Ted,” about a foul-mouthed teddy bear.

Their latest movie concerns a timid sheep rancher (MacFarlane) who falls in love with a married, sharpshooting cowgirl (Charlize Theron) and subsequently runs afoul of her outlaw husband (Liam Neeson).

The movie earns its R rating with a rapid-fire string of verbal and visual gags, the subject matter of which should be familiar to regular “Family Guy” viewers: over-the-top violence, flatulence, racism, drug use, sexism. It’s all here.

“We just start by writing what we think is funny,” Sulkin says. “In the movie, we get the advantage of the R rating. We can push it a bit more than we can on ‘Family Guy.’ ”

That doesn’t mean the writers aren’t sometimes surprised by just how far over the line they can step. We asked Sulkin and Wild for the top five jokes they couldn’t believe they got away with.

The shooting gallery scene from “A Million Ways to Die in the West”

Amanda Seyfried, Neil Patrick Harris, Seth MacFarlane and Charlize Theron in “A Million Ways to Die in the West”Lorey Sebastian/Universal Pictures

Premise: MacFarlane and Theron’s characters visit a county fair, where they play a midway game called “Runaway Slave.” The targets are painted with typically racist caricatures of African-Americans.

“Everything about it is completely offensive,” Wild says. “We’re making commentary about how terribly racist everyone was.”

Theron didn’t mind the joke.

“She adopted a black baby [son Jackson, 2], and I have a son who was the same age, and they’d have play dates,” Wild says. “I was wondering if she was gonna be extra-sensitive. She totally got it. It’s why she agreed to do the movie in the first place.”

The “Prom Night Dumpster Baby” song from “Family Guy”

Premise: In a cutaway, we see a teen girl dumping something in the trash behind her school. A baby rises and begins singing, “I miss my mom, but she’s at prom.”

“For cutaway gags . . . five or six writers come up with [pitches],” says Wild. “Among those will be one where we’re thinking, ‘This will never make it.’ ‘Prom Night Dumpster Baby’ was one of those.”

“That epidemic [of prom babies] was so ridiculous it felt like we’re not the a–holes,” Sulkin says. “The a–holes are the mothers doing it.”

“Once you get away with ‘Prom Night Dumpster Baby,’ that opens up a new precedent,” Wild says.

One controversial bit that never aired involved Pat Tillman, the footballer-turned-soldier killed in Afghanistan by friendly fire. A cutaway involved Peter, the father, joining Tillman’s platoon. As the commanding officer gives orders, Peter mistakenly repeats them as, “We’re going to shoot Pat Tillman in the head.” And the officer says, “No, no. Don’t shoot Pat Tillman in the head.”

The network nixed the joke.

“Seth ran into Pat Tillman’s brother and . . . he loved it, because it was all about how incompetent the military was,” Sulkin says.

Peter Griffin drives drunk on “Family Guy”

Premise: After a few drinks, Lois asks Peter to drive home. He claims he’s OK to drive because he knows exactly how many beers it takes before he gets too drunk. Cut to Peter arriving home. “Seven,” he says. Widen to reveal a mother and a baby smashed on the front of Peter’s car. “Six,” Peter corrects himself.

“I don’t understand how we got that on television,” Wild says. “It’s really dark. We got some push-back, but it wasn’t as bad as we thought.”

The grocery store scene in “Ted”

Premise: While trying to impress a pretty grocery store clerk, Ted the bear humps a scanner and suggestively squirts lotion on his face.

“That scene normally gets a tremendous recoil reaction,” Wild says.

“That seemed on edge,” Sulkin says. “For the most part, though, I think that movie came off as surprisingly sweet, and the things that were foul in it came off as harmless, like they were made of Nerf, because they came out of this cute, cuddly, animated bear’s mouth.”

Theron’s marriage story in “A Million Ways to Die in the West”

Theron in “A Million Ways to Die in the West”Universal Pictures

Premise: The frontierswoman recounts how she was married at 9 years old, but her husband waited to have sex with her — until she was 10.

“Because there’s no visual, it’s not that shocking,” Wild explains. “It’s shocking if you think about it, but again, it’s commentary.”