-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbricks.py
More file actions
31 lines (25 loc) · 795 Bytes
/
bricks.py
File metadata and controls
31 lines (25 loc) · 795 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
31
import numpy as np
from random import randint
class bricks:
def __init__(self,level):
self._arr = np.chararray((5))
self._arr = ['|','_','_','_','|']
self._level = level
self._rainbow = False
if self._level == 5:
self._rainbow = True
self._level = randint(0,3)
def brick_hit(self):
if self._rainbow==True:
self._rainbow = False
else :
if self._level>0 and self._level<4:
self._level = self._level -1
if self._level==0:
self._arr = [' ',' ',' ',' ',' ']
def level(self):
if self._rainbow == True:
self._level = ((self._level+1)%3)+1
return self._level
def __call__(self):
return self._arr