Bug Fix: color before replacement error

This commit is contained in:
Manish 2019-01-25 17:25:35 +01:00
parent a359923d57
commit e6b6d7dc6f
1 changed files with 5 additions and 5 deletions

View File

@ -169,14 +169,14 @@ class TrafficLight(object):
self.color = COLOR_BLACK
if actor.state == carla.libcarla.TrafficLightState.Green:
color = COLOR_GREEN
self.color = COLOR_GREEN
elif actor.state == carla.libcarla.TrafficLightState.Yellow:
color = COLOR_YELLOW
elif actor.state == carla.libcarla.TrafficLightState.Red:
color = COLOR_RED
self.color = COLOR_YELLOW
else:
self.color = COLOR_RED
self.surface = pygame.Surface((radius * 2, radius * 2))
pygame.draw.circle(self.surface, color, (radius, radius), radius)
pygame.draw.circle(self.surface, self.color, (radius, radius), radius)
def render(self, display):
display.blit(self.surface, (self.x, self.y))