Looking for these kinds of devices in Shakespeare's plays really lets us look at the language and word play that he is so well-known for. There are several examples of figurative language in Act 4 scene 2 when Hamlet is talking to Claudius and the assembled court about the whereabouts of Polonius's body. Here are a few examples:
When Rosencrantz asks about the body, Hamlet says that he won't tell him anything and is outraged "to be demanded of [by] a sponge." Rosencrantz responds in a way that suggests he doesn't understand Hamlet in his crazy talk, but we understand the metaphor clearly when Hamlet explain that Rosencrantz is sponge that "soaks up the King's countenance, his rewards ... but when he need what you have gleaned, it is but squeezing you and, sponge, you shall be dry again." This is quite an insult to what Rosencrantzthinks is his supposed importance. We laugh at Hamlet's wit, but hear the very serious message of the lines as well. This sets the tone and mood of the scene very clearly -- Hamlet is playing word games, but he is also threatening.
Later he tells the court that Polonius is "at supper...not where he eats, but where he is eaten. A certain convocation of politic worms are e'en at him." This is probably an allusion to the Diet of Worms -- he is making fun of Polonius thinking he is important politically in the court. Again, he is being funny, but he means more than what he actually says.
While Hamlet is making jests about the seriousness of his situation, Claudius is extremely disturbed and is looking to end the threat that Hamlet poses. Early in the act he compares Hamlet to a disease and says "Diseases desperate grown / By desperate appliance are relieved / Or not at all." He is specifically foreshadowing that to get rid of this disease he is going to have do something desperate -- have him killed in England. Claudius uses the disease metaphor later in the act when he says, "for like the hectic in my blood he rages,/ And thou [England] must cure me." These metaphors show the desperation and ends to which Claudius will go to maintain his kingship. Clearly there are two mighty foes, and the figurative language serves to enhance the tension before the final show-down.