-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.py
More file actions
30 lines (29 loc) · 806 Bytes
/
input.py
File metadata and controls
30 lines (29 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from getch import KBHit
import state
kbh = KBHit()
import Ball
import canvas
import BrickComplex
import Slider
import powerup
def onKeyPress():
char = kbh.getinput()
if char=='d':
state.slider.moveRight()
if char=='a':
state.slider.moveLeft()
if char=='p':
if state.cnvs.pause==True:
state.cnvs.pause=False
else:
state.cnvs.pause=True
if char=='q' and state.cnvs.pause==True:
state.quit = True
if char=='q' and not state.cnvs.pause==True:
state.cnvs.pause=True
if char=='r' and state.cnvs.gameover==True:
state.cnvs = canvas.Canvas()
state.slider = Slider.Slider()
state.ball = Ball.Ball()
state.bc = BrickComplex.BrickComplex()
state.pus = powerup.Powerups()