An Important Part Of Avengers: Endgame Was Heavily Influenced By One Harry Potter Scene
One of the more pleasant surprises of "Avengers: Endgame" was the early reveal that this was going to be a time travel story. The MCU had never really done time travel prior to this point, and for obvious reasons they would never really do it again. Messing with time can cause massive plot holes, after all, so it's best to do it sparingly. But as for how "Endgame" handled it? It's hard to complain. It gave fans an opportunity to go back through some of the series' greatest hits, allowing us to look back at how much our characters — particularly Captain America and Iron Man — had grown over the years. The storytelling choice was, by basically any measurement, a massive success.
Screenwriter Stephen McFeely looked to the first two "Back to the Future" movies as some inspiration for writing the movie, but most importantly he looked to "Harry Potter and the Prisoner of Azkaban," the 2004 movie that introduces surprise time travel in the final act. "I do love that third 'Harry Potter' movie, where a stone will break a vase. You don't know why and the scene's fine and it doesn't take you out of it," McFeely said in a 2019 interview. "Then when you come back around and you realize that they had thrown it at themselves, I do love that."
Not literally the same approach, but you get the idea
Admittedly this is kind of a strange comment to make, since time travel in "Endgame" doesn't really work the way it did in "Prisoner of Azkaban." In "Azkaban," everything Harry and Hermione did on their trip back in time turned out to have actually happened. They didn't change anything we'd see on screen; they just fixed things outside of the early Harry's perspective without being seen. "Endgame," meanwhile, works on the idea that every change in the past creates a parallel universe. Nothing our heroes do changes their current timeline.
What the two movies do have in common, however, is the way they introduce time travel in a surprising, cathartic way. Ant-Man's revelation about time travel is the ultimate hype moment, where the gloomy mood of the film's first act subsides and our grieving characters get to experience hope again for the first time in a while. Likewise, there's something particularly thrilling about Dumbledore's coded speech to Hermione in "Azkaban," where he gives her permission to finally use her time-turner for something other than homework.
It's a cool moment partly because it's the first time we've seen Hermione and Dumbledore interact, and partly because it pays off the ongoing subplot of Hermione's mysterious reappearances in class. But mostly it's because this is the moment we realize hope isn't lost. We'd already made peace with Buckbeak's death and the seemingly inevitable execution of Sirius Black, but suddenly we're being told that we don't actually have to accept that grim reality after all.
Avoiding one of Harry Potter's problems
One downside to the use of time travel in "Prisoner of Azkaban" was that it left the series with a big nagging question: Why don't the characters use time travel more often? Sure, we know that they can't change the past they've seen, but why doesn't Harry even think about time-turners again in the later books and movies? To deal with this, J.K. Rowling chose in the fifth book to have Neville accidentally knock over a shelf in the Department of Mysteries that contained all the other time-turners in existence. Hey, whatever works.
The MCU doesn't have this same issue, because we know that going back in time can't bring people from your own timeline back to life. The characters can change things in the past as much as they want, sure, but when they return to the present their own timeline will be exactly the same. (Well, except in Captain America's case at the end, but that's a whole other story.) So as much as the MCU may be struggling in recent years, they deserve some credit for somehow managing to introduce time travel into the final act of a massive movies-long saga without it feeling like a copout, or causing themselves issues down the line. It's a difficult feat, but they somehow pulled it off.