diff options
| author | Max <mahn.maxwell@gmail.com> | 2021-10-18 14:18:48 -0400 |
|---|---|---|
| committer | Max <mahn.maxwell@gmail.com> | 2021-10-18 14:18:48 -0400 |
| commit | 9126919b2e26ccca1b41bd5f695667aecc0ba242 (patch) | |
| tree | abc35cf530782c65395980f075c42994fb75505c /main.py | |
| parent | 282ef034da592e7da828048f68e231cb98f6178c (diff) | |
add arrow keys
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -2,14 +2,14 @@ import curses import math import random -# h a -key_left = [104, 97] +# h a left +key_left = [104, 97, 68] # l d -key_right = [108, 100] +key_right = [108, 100, 67] # j s -key_down = [106, 115] +key_down = [106, 115, 66] # k w -key_up = [107, 119] +key_up = [107, 119, 65] maxX = 4 @@ -33,14 +33,14 @@ def DrawSquare(x, y, val): stdscr.addstr(y + 2, x, "+" + "-" * (scaleX - 2) + "+") -def FullDraw(): +def FullDraw(key): stdscr.clear() - stdscr.addstr(maxY * scaleY, maxX * scaleX, "+") for i in range(maxY): for j in range(maxX): if gamestate[i][j] == 0: continue DrawSquare(j * scaleX, i * scaleY, gamestate[i][j]) + stdscr.addstr(maxY * scaleY, maxX * scaleX, "+") # PROCESSING @@ -154,8 +154,9 @@ def SpawnBlock(): # Init stdscr = curses.initscr() curses.noecho() +userin = 0 while True: - FullDraw() + FullDraw(userin) userin = stdscr.getch() if userin == 81: # Q break |
