Fans of Edgar Wright and Simon Pegg’s two perfectly hilarious, affectionately mocking genre-mash-up films “Shaun of the Dead” and “Hot Fuzz,” the first two films in the Cornetto Trilogy, will find the “The World’s End” absolutely (if not literally) sidesplitting.

Gary King (Mr. Pegg) is an immature 40-something trying to live in what for him is the happy past. He seeks out his four best school friends – grown well apart though they have – and convinces them to take a night off from their adult responsibilities to return to their home-town of Newton Haven and recreate their last, unsuccessful pub crawl, this time determined to succeed. Peter Page (Eddie Marsan, Lestrade in the 2009 and ‘11 Sherlock Holmes films), Oliver Chamberlain (Martin Freeman), Steven Prince (Paddy Considine), and Andy Knightley (Nick Frost), despite their better judgment, succumb to the pleas of their still-irresponsible, still-unreliable old friend from their past and find themselves at the first of Newton Haven’s 12 pubs, the beginning of the “Golden Mile.”

What might have been merely unpleasant changes for the worse when it transpires that many of the town’s inhabitants have been replaced by aliens from outer space – “blanks” or “nobots” who begin to follow the friends from pub to pub. Oliver’s sister Sam (Rosamund Pike), with whom Gary has a past and with whom Steven is in love, joins them.  As the five get more and more drunk, the aliens become single-minded. The situation becomes dire and only Sam is sober enough to drive. Gary tells her to get away in her car, leaving him to look out for the others – and to attain his goal: to complete the pub crawl, despite the alien invasion.

The replaced humans are hard, perhaps impossible, to kill. They pull themselves back together even after heads, arms, legs, are bashed to bits and gallons of inky blue ichor is spilled (it would be grotesque in red, it is true), and continue to pursue the friends, intent on convincing them that they wish to become “prepared” to join the civilized universe. And yet Gary races onward to the final pub – “The World’s End,” because, as he tells Andy, who begs him to leave off and escape, the Golden Mile is all he has.

Finally, the pub has its name for a reason.

Mr. Wright and Mr. Pegg like working with the same people from film to film, and many of the actors in “The World’s End” are in the earlier movies or in “Spaced,” their exceptionally funny – if more down to earth – British TV series that aired 1999-2001. Nick Frost, of course, is Mr. Pegg’s longtime friend in real life. They all have an ongoing easy rapport that communicates itself to the audience.

Gags from the earlier movies have been built on, including the nod to the Cornetto – the famed British ice cream novelty bar. Music again is supervised by Nick Angel (whose name was usurped for the protagonist of “Hot Fuzz”) and he has done a wonderful job with music by Primal Scream, Blur, The Stone Roses, The Doors, and more.

Those who have not yet seen “Shaun of the Dead” (a hysterical sendup of zombie flicks) or “Hot Fuzz” (a film that magnifies to absurdity the buddy-cop film as well as the differences between policing in Britain and the U.S.) may want to see them after seeing “The World’s End,” which does its magic on nostalgia and alien invasion. “The World’s End” is perhaps not as tight structurally as the earlier two, but is terrifically funny, while also emotionally layered.

Rated R; 109 minutes