diff --git a/terminis.py b/terminis.py index 0dca03a..65a2d4e 100644 --- a/terminis.py +++ b/terminis.py @@ -12,7 +12,9 @@ import random import sched import time - +# You can change controls here. +# Acceptable values are printable keys ('q', 'w'...) and curses's constants name starting with "KEY_" +# See https://docs.python.org/3/library/curses.html?highlight=curses#constants CONTROLS = { "MOVE LEFT": "KEY_LEFT", "MOVE RIGHT": "KEY_RIGHT", @@ -26,7 +28,6 @@ CONTROLS = { } - FILE = ".terminis" @@ -600,11 +601,11 @@ class Game: self.next.refresh(paused=True) self.scr.nodelay(False) while True: - key = self.scr.getch() - if key == ord('q'): + key = self.scr.getkey() + if key == CONTROLS["QUIT"]: self.playing = False break - elif key == ord('p'): + elif key == CONTROLS["PAUSE"]: self.scr.nodelay(True) self.hold.refresh() self.matrix.refresh() @@ -661,4 +662,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()