I was trying to build a T-Rex (The Dinosaur game available offline in chrome) clone in pygame. But now I'm facing an issue that is if the user presses the up arrow key the character stays there at the top all the time until the key is released as opposed to what happens in the T-Rex game.
I have coded it in such a way that when the user presses the up arrow key the character should go up by almost 80 pixels and come back when the key is released. But I need it to reverse back to its original position after a while even if the up arrow key is not released. So I placed a time.sleep() statement but it pauses the whole game along with the obstacles which is not intended.
Github link.