Lichter zum Leuchten bringen
This commit is contained in:
parent
753cb75b1d
commit
8369f3d4de
Binary file not shown.
|
@ -64,13 +64,16 @@ if __name__ == "__main__":
|
||||||
collisions = pygame.sprite.spritecollide(player.sprite, detectors, False)
|
collisions = pygame.sprite.spritecollide(player.sprite, detectors, False)
|
||||||
for detector in collisions:
|
for detector in collisions:
|
||||||
for lantern in lanterns:
|
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:
|
if lantern.id == detector.id:
|
||||||
lantern.light_up()
|
lantern.light_up(255, 255, 0)
|
||||||
|
|
||||||
|
|
||||||
if pygame.sprite.spritecollide(player.sprite, streets, False):
|
if pygame.sprite.spritecollide(player.sprite, streets, False):
|
||||||
player.sprite.set_back()
|
player.sprite.set_back()
|
||||||
|
|
||||||
|
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
clock.tick(60)
|
clock.tick(60)
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ class Lanterns(pygame.sprite.Sprite):
|
||||||
self.rect = self.image.get_rect(center=(left, top))
|
self.rect = self.image.get_rect(center=(left, top))
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
||||||
def light_up(self):
|
def light_up(self, r, g, b):
|
||||||
self.image.fill((255, 255, 0))
|
self.image.fill((r, g, b))
|
||||||
|
|
||||||
def reset_light(self):
|
def reset_light(self):
|
||||||
self.image.fill((0, 0, 0))
|
self.image.fill((0, 0, 0))
|
||||||
|
|
Loading…
Reference in a new issue