Update terminis.py
This commit is contained in:
parent
e92032542d
commit
2839995d79
13
terminis.py
13
terminis.py
@ -12,7 +12,9 @@ import random
|
|||||||
import sched
|
import sched
|
||||||
import time
|
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 = {
|
CONTROLS = {
|
||||||
"MOVE LEFT": "KEY_LEFT",
|
"MOVE LEFT": "KEY_LEFT",
|
||||||
"MOVE RIGHT": "KEY_RIGHT",
|
"MOVE RIGHT": "KEY_RIGHT",
|
||||||
@ -26,7 +28,6 @@ CONTROLS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FILE = ".terminis"
|
FILE = ".terminis"
|
||||||
|
|
||||||
|
|
||||||
@ -600,11 +601,11 @@ class Game:
|
|||||||
self.next.refresh(paused=True)
|
self.next.refresh(paused=True)
|
||||||
self.scr.nodelay(False)
|
self.scr.nodelay(False)
|
||||||
while True:
|
while True:
|
||||||
key = self.scr.getch()
|
key = self.scr.getkey()
|
||||||
if key == ord('q'):
|
if key == CONTROLS["QUIT"]:
|
||||||
self.playing = False
|
self.playing = False
|
||||||
break
|
break
|
||||||
elif key == ord('p'):
|
elif key == CONTROLS["PAUSE"]:
|
||||||
self.scr.nodelay(True)
|
self.scr.nodelay(True)
|
||||||
self.hold.refresh()
|
self.hold.refresh()
|
||||||
self.matrix.refresh()
|
self.matrix.refresh()
|
||||||
@ -661,4 +662,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user