show everyones flashlight
This commit is contained in:
parent
42f16fb2b8
commit
d07d15897b
1 changed files with 15 additions and 1 deletions
|
|
@ -37,7 +37,7 @@ class Light:
|
||||||
mx - self.game.player.hero.x, my - self.game.player.hero.y
|
mx - self.game.player.hero.x, my - self.game.player.hero.y
|
||||||
)
|
)
|
||||||
v.scale_to_length(self.game.player.hero.flashlight_strength)
|
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(
|
# self.game.screen.blit(
|
||||||
# pygame.transform.rotate(self.image, pygame.math.Vector2(0, 0).angle_to(v)),
|
# pygame.transform.rotate(self.image, pygame.math.Vector2(0, 0).angle_to(v)),
|
||||||
# (self.game.player.hero.x, self.game.player.hero.y - 250),
|
# (self.game.player.hero.x, self.game.player.hero.y - 250),
|
||||||
|
|
@ -53,6 +53,20 @@ class Light:
|
||||||
50,
|
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
|
# draw a circle
|
||||||
pygame.draw.circle(
|
pygame.draw.circle(
|
||||||
self.surf,
|
self.surf,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue