Electro (Jamie Foxx) can shoot electricity from his hands. There — now you know every interesting thing about him. (Sony Pictures)

Here’s the tricky thing with heroes: Without a bad guy, they’re nothing. Take away a hero’s enemy and you’re left with a guy (or girl, but let’s be real here — can you name Wonder Woman’s nemesis?) who can do cool stuff, but that stuff is really only useful if he wants to be the world’s highest-paid children’s birthday party entertainer.

That, in a nutshell, is the major problem with “The Amazing Spider-Man 2.” The film is visually nifty, and Andrew Garfield and Emma Stone as Spidey and his girlfriend have such serious old-school romantic chemistry it’s like Katharine Hepburn and Spencer Tracy reached down from heaven to sprinkle magical fairy banter dust on them. Frankly, the film would have succeeded if it were a rom-com, because that way the writers could have gotten rid of the fairly pointless, very sparky Electro (Jamie Foxx).

Electro starts out, as so many villains do, as a normal schlub. Max Dillon feels invisible at work, but that’s not really explored. He kind of has a creepy fascination with Spider-Man, but that’s not really explored. Then he falls into a tank of electric eels, gets some shocking (GET IT?) superpowers, and then he’s evil! Because … well, we don’t know. It’s not really explored.

The key to writing a bad guy is to make sure he thinks what he’s doing is right; everyone is the good guy in his own story. (The one exception is the Joker, but he proves the rule. Then burns the rule down and salts the earth where the rule once stood.) Which means every bad guy needs a story, and Electro doesn’t get one worth telling. “Suddenly bonkers” is not a motivation; a villain with no motivation is so flat he’s not worth rooting against.

Antagonist Harry Osborn gets less screen time but a better background, so he’s more interesting. More interesting than the guy who can shoot electricity from his hands. Really.

Foxx does what he can, but you can’t flesh out someone who has nothing inside. The writers of “The Amazing Spider-Man 2” seem to have forgotten that, in the end, you’re only as good as your bad guy.