-
Notifications
You must be signed in to change notification settings - Fork 0
/
path.py
40 lines (31 loc) · 1.2 KB
/
path.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
import pygame
import sys
class Path:
def __init__(self, corners, startColor, endColor, pathColor, pathWidth):
self.start = corners[0]
self.end = corners[len(corners) - 1]
self.corners = corners
self.startColor = startColor
self.endColor = endColor
self.pathColor = pathColor
self.pathWidth = pathWidth
def draw(self, surface):
for i in range(len(self.corners) - 1):
pygame.draw.line(surface, self.pathColor, self.corners[i], self.corners[i + 1], self.pathWidth)
pygame.draw.circle(surface, self.pathColor, self.corners[i], self.pathWidth // 2)
pygame.draw.circle(surface, self.startColor, self.start, 50)
pygame.draw.circle(surface, self.endColor, self.end, 50)
def get_start(self):
return self.start
def get_end(self):
return self.end
def get_corners(self):
return self.corners
def get_corner(self, index):
return self.corners[index]
def get_corner_count(self):
return len(self.corners)
def get_path_width(self):
return self.pathWidth
def set_path_width(self, width):
self.pathWidth = width