Having successfully made the extremely difficult transition from child star to successful adult actor, Joseph Gordon-Levitt tackles what’s arguably his most challenging project yet with “Don Jon,” which he wrote and directed in addition to starring in. Gordon-Levitt’s feature writing-directing debut tells the story of a macho New Jersey bartender whose porn addiction threatens his romantic relationships. But devoted fans and staunch opponents of porn alike can rest easy; this is neither a skin flick nor a sermon on the evils of lust. It is an entertaining movie with some great performances.

There are only a few things that matter to Jon Martello (Gordon-Levitt), he tells us in an opening voice-over, and at the top of that list is porn: “Nothing else does it for me.” He gives an extremely detailed explanation of why he prefers watching porn to performing various sexual positions, although he admits there are some drawbacks to watching movies (his complaint about the camera cutting to a man when he’s nearly ready to climax is one of the movie’s funniest lines). Although real women can’t possibly compare to his pornographic fantasies, he joins his friends at clubs, where they rate women on a scale of one to 10. One night he sees a “dime” named Barbara Sugarman (Scarlett Johansson) and is instantly tempted. She initially rejects his advances, but before long they’re dating.

Barbara is addicted to a film genre herself: romances. She dreams about having a life like those of the happy couples she sees on the screen, and it’s soon clear that she sees Jon less as a boyfriend than a way to fulfill those dreams. While making out one night, she manages to convince Jon that they should take the important step of meeting each other’s parents. Each of Jon’s family members has their own obsession: his father (Tony Danza) fixates on football, his mother (Glenne Headly) is desperate for her son to settle down and provide her with grandchildren and his sister (Brie Larson) does nothing but play with her phone, even in church.

At Barbara’s request, Jon also enrolls in a night school class, where he meets a strange woman named Esther (Julianne Moore). She catches him watching porn on his phone in class, and, believing he can do better, gives him a 1970s porno as a present. As Jon’s relationship with Barbara crumbles (she’s disgusted when she discovers the frequency of his porn habit), his relationship with Esther grows deeper. A frank discussion between the two of them in a car about sexual needs and desires is one of the movie’s best scenes.

This is a role unlike any Gordon-Levitt has played before, and he’s outstanding. Jon could have been merely a selfish creep if played by the wrong actor, but Gordon-Levitt makes him into a three-dimensional character we care about. It’s amusing to see him regularly attend church and seek forgiveness during confession, only to commit the very sins again after he leaves. Johansson is good in a standard girlfriend role, although more could’ve been done to develop her obsession with romantic movies. It would’ve been fun to see the contrast between Jon’s and Barbara’s fantasies more deeply explored. Tony Danza, long associated with family-friendly roles, is a pleasant surprise as the foul-mouthed patriarch who seems almost jealous at times of his son’s new woman. Brie Larson only speaks once during the movie but perfectly delivers a brief monologue of surprising insight. Moore is good, too, although her character seems to come out of left field.

One of the movie’s ads tell us that “There’s more to life than a happy ending,” but “Don Jon” nevertheless gives us one. There’s a sense that Gordon-Levitt was unsure how to finish the story and tacked on a conclusion more upbeat than what had gone before. A far darker movie could no doubt be made about this same subject, but “Don Jon” is a good entertainment as well as a triumphant directorial debut for Gordon-Levitt. Imagine what he’ll do now that he has some experience.