diff --git a/code/__pycache__/sprites.cpython-310.pyc b/code/__pycache__/sprites.cpython-310.pyc index 13689d0..b89a9f3 100644 Binary files a/code/__pycache__/sprites.cpython-310.pyc and b/code/__pycache__/sprites.cpython-310.pyc differ diff --git a/code/simulation.py b/code/simulation.py index bfa1805..4b35327 100644 --- a/code/simulation.py +++ b/code/simulation.py @@ -64,13 +64,16 @@ if __name__ == "__main__": collisions = pygame.sprite.spritecollide(player.sprite, detectors, False) for detector in collisions: for lantern in lanterns: + if lantern.id == detector.id - 1 and lantern.id is not 8 or lantern.id == detector.id + 1 and lantern.id is not 8: + lantern.light_up(176, 179, 0) if lantern.id == detector.id: - lantern.light_up() + lantern.light_up(255, 255, 0) + if pygame.sprite.spritecollide(player.sprite, streets, False): player.sprite.set_back() - + pygame.display.update() clock.tick(60) diff --git a/code/sprites.py b/code/sprites.py index 700af23..5c51def 100644 --- a/code/sprites.py +++ b/code/sprites.py @@ -53,8 +53,8 @@ class Lanterns(pygame.sprite.Sprite): self.rect = self.image.get_rect(center=(left, top)) self.id = id - def light_up(self): - self.image.fill((255, 255, 0)) + def light_up(self, r, g, b): + self.image.fill((r, g, b)) def reset_light(self): self.image.fill((0, 0, 0))