Ignore:
Timestamp:
09/04/13 22:36:30 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

(really rubbish) bullets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r256 r261  
    66from nagslang.constants import (
    77    SWITCH_PUSHERS, COLLISION_TYPE_SWITCH, COLLISION_TYPE_BOX, ZORDER_LOW,
    8     ZORDER_FLOOR, COLLISION_TYPE_DOOR)
     8    ZORDER_FLOOR, COLLISION_TYPE_DOOR, COLLISION_TYPE_PROJECTILE)
    99from nagslang.resources import resources
    1010from nagslang.events import DoorEvent
     
    293293        return [("name", "string"), ("end1", "coordinates"),
    294294                ("end2", "coordinates"), ("key_state", "puzzler")]
     295
     296
     297class Bullet(GameObject):
     298    def __init__(self, space, position, impulse):
     299        body = make_body(1, pymunk.inf, position)
     300        self.shape = pymunk.Circle(body, 1)
     301        self.shape.collision_type = COLLISION_TYPE_PROJECTILE
     302        super(Bullet, self).__init__(
     303            SingleShapePhysicser(space, self.shape),
     304            render.ImageRenderer(resources.get_image('objects', 'bullet.png')),
     305        )
     306        self.physicser.apply_impulse(impulse)
Note: See TracChangeset for help on using the changeset viewer.