-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbreakout_drawing.py
executable file
·28 lines (24 loc) · 1.07 KB
/
breakout_drawing.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
import math,pygame,sys,shutil,getpass, os, commons
from pygame.locals import *
from collections import deque
width,height = commons.width, commons.height #dimensions of board
screen = commons.screen
blockX,blockY = commons.blockX, commons.blockY #board position
#generic colors-------------------------------
red, green, blue, white, grey, black = commons.default_colors()
#Functions defined----------------------------
def print_board(board,colors): #prints the board
for x in range(width):
for y in range(height):
if board[x][y] == 1:
pygame.draw.rect(screen,colors[y],(((x*8)+blockX),((y*6)+blockY),9,7))
def print_paddle(paddle): #prints the paddle
if paddle.size == 2:
#pygame.draw.rect(screen,red,((paddle.x),(paddle.y),30,5))
pygame.draw.rect(screen,red,((paddle.x),(paddle.y),paddle.width,paddle.height))
def black_screen(x, y):
for i in xrange(x):
for j in xrange(y):
pygame.draw.rect(screen,black,(i*40,j*40,40,40))
pygame.display.update()
pygame.time.wait(2)