summaryrefslogtreecommitdiff
path: root/cameltris/piece.py
diff options
context:
space:
mode:
Diffstat (limited to 'cameltris/piece.py')
-rw-r--r--cameltris/piece.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/cameltris/piece.py b/cameltris/piece.py
index 1bbe2c4..d8e7b63 100644
--- a/cameltris/piece.py
+++ b/cameltris/piece.py
@@ -2,18 +2,10 @@
import pygame
+from .color import Color
-square_template = pygame.Surface((48, 48))
-black = (0, 0, 0)
-white = (0xff, 0xff, 0xff)
-brown = (163, 75, 31)
-blue = (30, 34, 164)
-green = (30, 164, 59)
-red = (164, 30, 30)
-purple = (126, 30, 164)
-yellow = (164, 164, 30)
-cyan = (30, 164, 150)
+square_template = pygame.Surface((48, 48))
class Piece:
@@ -37,7 +29,7 @@ class ZPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(blue)
+ self.square.fill(Color.blue.value)
self.elements = (self.square, self.square, None), (None, self.square, self.square), (None, None, None)
self.vertical = False
@@ -60,7 +52,7 @@ class SPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(green)
+ self.square.fill(Color.green.value)
self.elements = (None, None, None), (None, self.square, self.square), (self.square, self.square, None)
self.vertical = False
@@ -83,7 +75,7 @@ class SquarePiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(brown)
+ self.square.fill(Color.brown.value)
self.elements = ((self.square, self.square), (self.square, self.square))
@@ -91,7 +83,7 @@ class IPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(red)
+ self.square.fill(Color.red.value)
self.elements = (None, None, None, None), (None, None, None, None), (self.square, self.square, self.square, self.square), (None, None, None, None)
self.vertical = False
@@ -114,7 +106,7 @@ class LPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(cyan)
+ self.square.fill(Color.cyan.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (None, None, self.square)
@@ -122,7 +114,7 @@ class JPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(purple)
+ self.square.fill(Color.purple.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (self.square, None, None)
@@ -130,5 +122,5 @@ class TPiece(Piece):
def __init__(self):
super().__init__()
- self.square.fill(yellow)
+ self.square.fill(Color.yellow.value)
self.elements = (None, None, None), (self.square, self.square, self.square), (None, self.square, None)