-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrick.py
42 lines (28 loc) · 902 Bytes
/
brick.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
#####################################################
#
# breakout game with pygame
# for Python stage in Technofutur TIC (Belgium)
# Authors : Bastien Wiaux and Benoit Ronval
#
#####################################################
from constants import *
import pygame
class Brick:
def __init__(self, x, y):
"""
initialise un objet Brick avec x et y la position de depart
"""
self.x = x
self.y = y
self.rectangle = pygame.Rect(x, y, BRICK_WIDTH, BRICK_HEIGHT)
self.color = "white"
def draw(self, window):
"""
Dessine l'objet brick sur la window
"""
pygame.draw.rect(window, self.color, self.rectangle)
def change_color(self, new_color):
"""
change la couleur de la brick pour new_color
"""
self.color = new_color