Mercurial > nagslang
changeset 560:57efcd81647b
SokoBox.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 07 Sep 2013 22:15:10 +0200 |
parents | 145d26878ecf |
children | 66dd5ac002b7 |
files | nagslang/game_object.py |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/nagslang/game_object.py Sat Sep 07 22:14:34 2013 +0200 +++ b/nagslang/game_object.py Sat Sep 07 22:15:10 2013 +0200 @@ -359,6 +359,25 @@ ("state_source", "puzzler")] +class SokoBox(GameObject): + def __init__(self, space, position): + body = make_body(1, pymunk.inf, position) + self.shape = pymunk.Poly( + body, [(-40, -40), (40, -40), (40, 40), (-40, 40)]) + self.shape.friction = 0.5 + self.shape.collision_type = COLLISION_TYPE_FURNITURE + super(Box, self).__init__( + SingleShapePhysicser(space, self.shape), + render.ImageRenderer( + resources.get_image('objects', 'sokobox.png')), + ) + + @classmethod + def requires(cls): + return [("name", "string"), ("position", "coordinates"), + ("state_source", "puzzler")] + + class BaseDoor(GameObject): zorder = ZORDER_FLOOR is_open = True