Hello all,
I'm posting this since I've looked on Google and on Pygame's IRC channel and haven't gotten anything useful out of it.
I have a game in Python 3.x using Pygame. The game has a map editor and with it, my idea is that you could define characteristics of the room (i.e. adding, modifying, destroying, ...) with it using simple keypresses, I.e. to set the rooms reverb you'd press s, then r, then r, then 1 (since the reverb has two values: reverb, and reverb2 (reverb depth)). I've tried the following:
Checking if s, r, r, and 1 were pressed in one while loop (doesn't work because you can't check if the same key was pressed twice in a single if block);
Changing the second r to e so then you'd need to press s, r, e, and 1 (doesn't work because you have to hold them down, which is incredibly difficult);
Creating a function chain, so you press s, it calls a function, r calls another function, and e calls another, then 1 and 2 call another (gets way too complicated really, really fast, and puts way more stress on me when updating the editor later; also causes code bloat); and
Creating an event loop and a key loop which:
Polls the Pygame event queue every iteration, and
Calls pygame.key.get_pressed() each iteration.
The fourth one is desirable because, while it seems over-complicated, it gives me more control over the keyboard. Here's what I'm trying to do:
Determine if either 'A', 'S', or 'D' are pressed (K_a, K_s, or K_d).
Somehow, if, after A, S, or D are released, determine if another key is pressed.
Perform an action.
If anyone has any ideas on the simplest way to do this, please let me know on this topic. I'm getting really confused by it, and the last thing I want to do is create a command interpreter that all users (even newbies) have to use to create maps (where you have to type, say, 'srr1 100' or 'srr2 13000'). Most people would think that's way too technical, and I don't want any confusion for newbies. At the same time, I don't want to have to come up with billions of key combinations to modify the map.
My Github