-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathColumn.py
More file actions
32 lines (28 loc) · 918 Bytes
/
Column.py
File metadata and controls
32 lines (28 loc) · 918 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
32
import pygame
class Column:
def __init__(self, screen, color, x,y,width,height):
self.screen=screen
self.color=color
self.x=x
self.y=y
self.width=width
self.height=height
self.paintInside = False
def Draw(self, columnColor):
if self.paintInside:
pygame.draw.rect(self.screen, self.color, (self.x,self.y,self.width,self.height))
self.paintInside = False
else:
pygame.draw.rect(self.screen, columnColor, (self.x,self.y,self.width,self.height), 1)
self.color = (255, 255, 255)
def replace(self, Column):
self.changeColor((255,0,0))
tempx = self.x
tempy = self.y
self.x = Column.x
Column.x = tempx
self.y = Column.y
Column.y = tempy
def changeColor(self, color):
self.color = color
self.paintInside = True