Features
--------
-* Turnip / light spacing bug: a light can be placed right below a turnip, but must be much further away if above the turnip. This happens whether the turnip or the light is placed first. I assume it has to do with how the turnip image is positioned relative to its body.
* Allow denser turnip spacing
* Allow going down to zero seeds by buying lights if a turnip is planted
* Maybe make the mould weaker at the start
* Five levels
* Bug: have to click lights multiple times to turn them back on after the power has died
* Bug: Crash when removing a rotating light
+* Turnip / light spacing bug: a light can be placed right below a turnip, but must be much further away if above the turnip. This happens whether the turnip or the light is placed first. I assume it has to do with how the turnip image is positioned relative to its body.
def render_fitting(self, surface):
rx, ry = self.ray_manager.pygame_position(surface)
- surface.blit(self.fitting_image(), (rx - 24, ry - 24), None, 0)
+ surface.blit(self.fitting_image(), (rx - self.FITTING_RADIUS, ry - self.FITTING_RADIUS), None, 0)
def power_usage(self):
if not self.on:
# since that looks weird, but we don't want to center
# the turnip under the mouse either, since that
# causes issues as well, so we compromise
- pos = (ev.pos[0] - 18, ev.pos[1] - 18)
+ pos = (ev.pos[0] - 6, ev.pos[1] - 6)
try:
turnip = Turnip(age=0, pos=pos, space=self._space)
self._turnips.append(turnip)
class Turnip(object):
+ TURNIP_RADIUS = 24
def __init__(self, **kwargs):
self._age = kwargs.get('age', 0)
self._update_image()
self.eaten = False # Flag for boyd
self._body = pymunk.Body(0, 0, pymunk.Body.STATIC)
- self._shape = pymunk.Circle(self._body, 24)
+ self._shape = pymunk.Circle(self._body, self.TURNIP_RADIUS)
self._shape.filter = TURNIP_FILTER
self._body.position = pymunk.pygame_util.from_pygame(
self._pos, pygame.display.get_surface())
self._image = pygame.transform.rotate(self._image, self._rotation)
def render(self, surface):
- surface.blit(self._image, self._pos, None)
+ rx, ry = self._pos
+ surface.blit(self._image, (rx - self.TURNIP_RADIUS, ry - self.TURNIP_RADIUS), None)
def serialize(self):
return {'age': self._age, 'pos': self._pos}