I have been making an ascii based game. It uses curses and timeout to make the game not wait for user input. But pressing a key repeatedly will make the game much more faster. I was wondering if there was a way to stop this.
screen.timeout(300)
while run:
screen.clear()
print_map()
curses.flushinp()
action = screen.getch()
# Movement
if action == curses.KEY_UP:
player.xy["y"] -= 1
if action == curses.KEY_DOWN:
player.xy["y"] += 1
if action == curses.KEY_LEFT:
player.xy["x"] -= 1
if action == curses.KEY_RIGHT:
player.xy["x"] += 1
While holding down a key, enemies and NPCs move faster. I have tried many things and searched the internet for a way to fix this. But I can't find a way to fix this.