Ask coding questions

← Back to all posts
HELP! Pygame's pygame.key.get_pressed() Not Working!
BitMimic (4)

Please help. I am making a randomized L.O.Z style dungeon crawler in pygame. So far I only have a randomized map and the current room. I am trying to make it so that when you press the arrow keys that you can see the different rooms, but for some reason, it seems that it cannot detect that I am even pressing the keys. If you can have a look at my code and tell me what I am doing wrong and/or how to fix it, it would be greatly appreciated. Thanks!


Re-check the variable that is connected to the arrow key, and the variable that is connected to the thing that moves it.

BitMimic (4)

All the variables seem to be right. I checked the class and made sure the variables are right. I even looked up an example of how to use the pygame keypresses and I can't figure out whats wrong @novaflippers

BitMimic (4)

I fixed it. I ended up using pygame.event.get and pygame.KEYDOWN and it worked. Thanks for trying to help! @novaflippers