-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patho_block.py
33 lines (25 loc) · 966 Bytes
/
o_block.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
from turtle import Turtle
from tetris_block import TetrisBlock
# to indicate the position of individual segment of the block
POSITION_LIST = [(-20, 270), (2, 270), (2, 292), (-20, 292)]
class OBlock(TetrisBlock):
def __init__(self):
super().__init__()
self.create()
self.set_up()
def create(self):
"""
This method is to create segments of OBlock"""
for position in POSITION_LIST:
new_segment = Turtle("square")
new_segment.penup()
new_segment.color("white")
new_segment.speed("fastest")
new_segment.goto(position)
self.tetris_block_segments.append(new_segment)
def set_up(self):
"""
This method used to set the front of the Block"""
self.front.extend([self.tetris_block_segments[0], self.tetris_block_segments[1]])
for segment in self.tetris_block_segments:
segment.setheading(270)