-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.py
executable file
·46 lines (37 loc) · 1.57 KB
/
board.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import config
import random
from time import sleep, time
from colorama import init, Fore, Back, Style
init()
import global_variables
class Board():
height = int(config.rows)
length = int(config.columns)
def __init__(self):
self.begin_time = time()
self.matrix = [[ " " for i in range(self.length)] for j in range(self.height) ]
self.border()
def render(self):
global_variables.total_time = time()-self.begin_time
print("you have 300 seconds in game and 5 lives.")
print(" 'q' for quit , 'a' and 'd' for moving paddle left and right resp. , 'x' for shoot the ball ")
print("lives left:",config.lives," score:" , config.score+global_variables.explosion_score() , " time till now:",int(global_variables.total_time) , "level: ", global_variables.level)
print("health of ufo : ", global_variables.main_ufo.lives)
print("health bar of ufo : [",end="")
for i in range(1,101):
if i <= global_variables.main_ufo.lives:
print('#',end="")
else:
print('.',end="")
print(']')
global_variables.powerup_top_string()
for y in range( self.height):
lol = []
for x in range( 0 , config.columns):
lol.append(self.matrix[y][x] + Style.RESET_ALL)
print(''.join(lol))
def border(self):
for x in range(self.length):
self.matrix[3][x] = "X"
for x in range(self.length):
self.matrix[39][x] = "="