Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced the UI and added Keyboard Support for options #14

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
11 changes: 9 additions & 2 deletions math_hurdler.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,15 @@ def evaluate_answer(answer):
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_p:
self.paused = not self.paused
elif event.key == pygame.K_c:
set_answer(self.question.answer_index)
# Select options by 1,2,3,4 or A,B,C,D keys
jriyyya marked this conversation as resolved.
Show resolved Hide resolved
elif event.key == pygame.K_a or event.key == pygame.K_1:
set_answer(0)
elif event.key == pygame.K_b or event.key == pygame.K_2:
set_answer(1)
elif event.key == pygame.K_c or event.key == pygame.K_3:
set_answer(2)
elif event.key == pygame.K_d or event.key == pygame.K_4:
set_answer(3)
elif event.type == pygame.MOUSEBUTTONDOWN:
if not self.gameover:
for i in range(0, 4):
Expand Down