import pygame.surface
import pygame.display
-import pygame.locals as pgl
-
from .constants import (SCREEN_SIZE, MOULD_CATEGORY, OBSTACLE_CATEGORY,
TURNIP_CATEGORY)
from .loader import loader
query[0].shape.body.turnip.eaten = True
return refresh
- def damage(self, light_color, intensity, space, moulds):
+ def damage(self, light, space, moulds):
"""Take damage for light, adjusted for resistances."""
+ distance = light.position.get_distance(self.position)
+ if distance < (light.radius_limits[0] or 0.0):
+ return False
+ if distance > (light.radius_limits[1] or 50.0):
+ return False
self._health -= 3
if self._health <= 0 and self._age <= 120:
# We die of damage
class Boyd(object):
def __init__(self, gamestate, space):
- seed = Mould(gamestate, space, (350, 370))
+ seed = Mould(gamestate, space, (275, 300))
self._moulds = [seed]
self._image = pygame.surface.Surface(SCREEN_SIZE)
self._image = self._image.convert_alpha(pygame.display.get_surface())
lit_by = lights.light_query(mould._shape)
for light in lit_by:
# Todo: extract colour and intensity from light
- if mould.damage(None, None, space, self._moulds):
+ if mould.damage(light, space, self._moulds):
redraw = True
break # we only die once
if redraw: