In the film, Humpty first appears in the underground bar, revealing that he had hired Kitty Softpaws to bring Puss to him. He had located the magic beans that he and Puss spent their childhood searching for. However, Puss refuses, saying that Humpty is a traitor (which the egg denies) and leaves.
Later on, Puss tells Kitty that Humpty was his only friend at the orphanage that they both grew up in and not his brother. However, as they grew up, the harmless pranks they performed as children soon turned into crimes. This changes when Puss stops a bull from killing the head soldier's elderly mother. Puss, the new town hero, had less time to spend with Humpty, leaving him desperate, he attempts to steal without Puss, landing him in jail, until Puss bails him out and tells him he is not stealing anymore. In his desperation, he wakes up Puss one night, telling him he owes Little Boy Blue (the orphanage bully and the reason they became best friends) and his gang money, so asks Puss to help him leave town. When Puss gets him over what he believes to be the town wall, he realizes in horror that the "town wall" was actually the wall around the town bank, which Humpty had just robbed. Humpty escapes with all the money in the bank as the alarm goes off. The police arrive immediately, and, seeing Puss with Humpty, believes he helped in the crime.
Wrongly accused, Puss flees with Humpty in their cart, which is destroyed on the bridge, and all the money in the town falls in the river. In his desperation and depression, Puss jumps in the water. This event is what leads to the frosty relationship between Puss and Humpty. Later, seduced by Kitty, Puss agrees to go with them on their journey. Eventually, they steal the magic beans from Jack and Jill, an act which nearly costs them their lives. Soon after, they reach the only soil in which the magic beans can grow. In the clouds, they sneak into the long-dead giant's castle, steal the golden goose, and escape. After they celebrate and go to sleep, Jack and Jill come and knock Puss out. When he wakes up, he follows their trail to his hometown, where he is shocked to find Humpty handing out golden eggs to the residents. Humpty explains that it was all as part of his master plan to get revenge, and that everyone, the bar patrons, Jack and Jill, even Kitty, worked for him. He then has Puss arrested. While Puss is in jail, Puss learns that the Great Terror, the monster they encountered in the castle, will come and destroy the town in order to retrieve the Golden Goose (which was Humpty's plan all along), as the Great Terror is a giant goose who is the mother, and the Golden Goose is its baby. Puss, however, convinces Humpty against it.
However, it is too late. As the Great Terror descends on the town, Humpty helps lead it to the bridge, where he sacrifices himself so Puss can give the mother the golden goose. As the mother is about to leave, Puss sees where Humpty landed in the canyon, where he sacrificed himself, a golden egg surrounded by eggshell. The mother takes the egg back with her, and Puss says to himself, "I always knew you were good inside." Though, during the end credits, Humpty is seen in his normal form, dancing on the mother's back with the golden goose.
Humpty's grave can be seen. This is likely due to everyone believing Humpty was destroyed, either when he fell into the cloud at the end of the film or when he fell off the bridge, or it's an entirely different egg with the same name.
Video Game AppearancesIn Shrek: Reekin' Havoc, Humpty Dumpty appears as one of the bosses.
Humpty Dumpty appears as a secret character in the video game, Shrek Super Slam. He is the only secret character who has an alternate outfit. Humpty's Super Slam is that he spins around on his head around the stage. He also appears in the story where he confronts Princess Fiona and battles with her.
Humpty Dumpty also appears in Shrek Smash and Crash Racing and apparently has changed his outfit now. He now has glasses and wears a shirt under his bretels. Humpty Dumpty is one of the eight unlockable racers in this game. He is one of the two characters that have not appeared in the Shrek films, but made an appearance in Shrek Super Slam. Humpty Dumpty in this game wears glasses. Humpty Dumpty's kart is the Chicken Cup and his personal item is a frying pan.