Code: Alles auswählen
class WayGui:
def __init__(self, way, surface):
self.way = way
self.surface = surface
def draw_way(self, radius, position):
pi2 = 2 * 3.14
for i in range(6):
if self.way.water_connections[i]:
pygame.draw.line(self.surface, BLUE, position,
(cos(i / 6 * pi2) * radius + position[0],
sin(i / 6 * pi2) * radius + position[1]),
1)
for i in range(6):
if self.way.ground_connections[i]:
pygame.draw.line(self.surface, BROWN, position,
(sin(i / 6 * pi2) * 87 / 100 * radius + position[0],
cos(i / 6 * pi2) * 87 / 100 * radius + position[1]),
1)
if self.way.name == "+2 Elexier":
pygame.draw.circle(self.surface, RED, position, radius / 3)
elif self.way.name == "Shop":
pygame.draw.circle(self.surface, GREEN, position, radius / 5)
elif self.way.name == "+1 Way":
pygame.draw.circle(self.surface, BROWN, position, radius / 5)
elif self.way.name == "+1 Card":
pygame.draw.rect(self.surface, WHITE,
((position[0] - radius / 10, position[1] - radius / 8), (radius / 5, radius / 4)))
elif self.way.name == "+1 Elexier":
pygame.draw.circle(self.surface, RED, position, radius / 5)
elif self.way.name == "Water Oasis":
pygame.draw.circle(self.surface, BLUE, position, radius / 5)
elif self.way.name == "Portal":
pygame.draw.circle(self.surface, LILA, position, radius / 4)
return pygame.draw.lines(self.surface,
WHITE,
True,
[(cos(i / 6 * pi2) * radius + position[0], sin(i / 6 * pi2) * radius + position[1]) for
i
in range(6)],
5)
zum beispiel will ich jetzt ma das wenn ich auf einen Weg clicke der Hintergrund ne andere Farbe bekommt