show everyones flashlight

This commit is contained in:
Waylon Walker 2023-06-30 08:46:42 -05:00
parent 42f16fb2b8
commit d07d15897b
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4

View file

@ -37,7 +37,7 @@ class Light:
mx - self.game.player.hero.x, my - self.game.player.hero.y
)
v.scale_to_length(self.game.player.hero.flashlight_strength)
self.game.player.hero.flashlight_angle = v.angle_to(pygame.math.Vector2(0, 0))
self.game.player.hero.flashlight_angle = v.angle_to(pygame.math.Vector2(0, 1))
# self.game.screen.blit(
# pygame.transform.rotate(self.image, pygame.math.Vector2(0, 0).angle_to(v)),
# (self.game.player.hero.x, self.game.player.hero.y - 250),
@ -53,6 +53,20 @@ class Light:
50,
)
for other in self.game.player.others.__root__:
v = pygame.math.Vector2(0, 1)
v = v.rotate(-other.flashlight_angle)
v.scale_to_length(other.flashlight_strength)
for r in range(-25, 25):
_v = v.rotate(r)
pygame.draw.line(
self.surf,
(255, 250, 205),
(other.x, other.y),
(other.x + _v.x, other.y + _v.y),
50,
)
# draw a circle
pygame.draw.circle(
self.surf,