Reputation: 1
I am making a game in python, but I want python to react to the W,A,S,D keys without pressing enter. Like:
If w in console: Y_pos = Y_pos + 1
If you guys could tell me how to do that then that would be a big help
Upvotes: 0
Views: 621
Reputation: 59
Maybe keyboard package is what you need. Various usages for your information.
Upvotes: 1
Reputation: 68
Take a look at some of the answers here. In general, you need an infinite while
loop that will accept the user input. Don't forget an exit condition, otherwise you'll have to kill the program to end it.
If you're doing this for practice, kudos. But, in case you're focused on making a working game, not on python itself, may I suggest pygame engine for starters?
Upvotes: 1