Let’s make a simple keyboard racing game using Python. In the game, the participant clicks a pair of keys in quick succession and the program shows the total time taken by the racer to cover the distance.
As soon as you see ‘GO!’ on screen, start pressing the keys ‘z’ and ‘x’. A ‘*’ sign is shown for every metre covered. Pressing ‘z’ and ‘x’ once will be counted as 1 metre; targets is to cover 10 metres.
msvcrt : Used to get keystroke as input for race time : Used to calculate time taken to complete the race
Note that MSVCRT module can only function on a terminal window, not on a GUI program/IDE.
Below is the code:
- Keyboard module in Python
- Mouse and keyboard automation using Python
- Python | Vkeyboard (virtual keyboard) in kivy
- Simple Plot in Python using Matplotlib
- Python | Simple calculator using Tkinter
- Python | Simple GUI calculator using Tkinter
- Simple Chat Room using Python
- Python | Make a simple window using kivy
- Python | Simple registration form using Tkinter
- Python | Simple FLAMES game using Tkinter
- Simple Multithreaded Download Manager in Python
- Python | Creating a Simple Drawing App in kivy
- Create a simple Animation using Turtle in Python
- Python | Program to implement simple FLAMES game
- Python | Create a simple assistant using Wolfram Alpha API.