Say what you will about SpongeBob SquarePants, he’s an eternal optimist. He may live under the sea, but his spirits are forever buoyant. And just as the Nickelodeon cash cow has decorated children’s pajamas and board games and lunch boxes and Mall of America roller coasters since his 1999 TV debut, he hopes we’ll still love him on the big screen, too.

The second SpongeBob film submerges a dozen wee, TV-sized skits in ocean-deep seas of feature-length narrative. Yet for all its hit-or-miss moments, “The SpongeBob Movie: Sponge Out of Water” weaves a silly — and often funny — spell. It’s a scrappy little B-movie that zips along rather entertainingly.

It begins in a realm of live action narration from Burger-Beard (Antonio Banderas), a curmudgeonly pirate seeking to rob submerged Bikini Bottom. That’s where SpongeBob (voiced by Tom Kenny), the almost idiotically cheerful sea sponge resembling a kitchen scrubber, resists the forces of skepticism and snobbery.

He works as a lowly fry cook at the popular Krabby Patty diner, but unlike his tentacled coworker Squidward (Rodger Bumpass), he is no ennui-ridden sourpuss, but triumphant innocence incarnate. He may be the source of continual sight gags and nutty wordplay, but his soul is pure. Mood swings are beyond him. (There may be some logic here: Stephen Hillenburg, the show’s creator, taught marine biology for three years before getting a degree in animation.)

By contrast, Burger-Beard is a sort of bombastic James Bond villain. He wants to steal Krabby Patty’s secret food formula for his own ocean-side snack bar. Burger-Beard’s nefarious plan brings SpongeBob and his underwater friends into realms they’ve never explored before.

SpongeBob, an endlessly cheerful advocate of teamwork, pulls several sea-creature friends into his squad. When polite persuasion in 2-D animation fails to halt Burger-Beard’s larceny, SpongeBob and crew don masks and leather, moving to 3-D effects of freak-show superheroism. They develop pumpkin-sized biceps and steroid-pumped abs, like a 22-minute cartoon being bloated into 93 minutes of film.

The film staggers around countless subplots, a severe episode of “second-film slump” in puzzle-like storytelling structure. Of course the kind of jumping from scene to wildly uneven scene that makes adults look at their watches cause kids to snort with laughter. They’re tickled silly by everything in the film that is fast-paced, fabulously forged and cheerfully fake.

“The SpongeBob Movie: Sponge Out of Water” isn’t the equivalent of “The Lego Movie,” which combined brains and laughs in equal measure for every age range. It’s the Red Bull of animated kids’ comedies, with a few extra shots of Rockstar, Monster and 5 Hour Energy thrown in. It deliberately, merrily fuels a hyperactive, synthetic buzz.