Changeset 363:3dd08e18580f


Ignore:
Timestamp:
Sep 6, 2013, 6:25:06 PM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Message:

Acid attacks shoot things that look like acid

Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • nagslang/enemies.py

    r361 r363  
    221221        if self.lifetime - self._last_fired >= self.reload_time:
    222222            FireEvent.post(pos, vec_with_length((dx, dy), ACID_SPEED),
    223                            ACID_DAMAGE, COLLISION_TYPE_ENEMY)
     223                           ACID_DAMAGE, 'acid', COLLISION_TYPE_ENEMY)
    224224            self._last_fired = self.lifetime
    225225        super(ChargingAlien, self).update(dt)
  • nagslang/events.py

    r333 r363  
    4949class FireEvent(UserEvent):
    5050    @classmethod
    51     def post(cls, source, impulse, damage, source_collision_type):
     51    def post(cls, source, impulse, damage, bullet_type, source_collision_type):
    5252        super(FireEvent, cls).post(source=source, impulse=impulse,
    53                                    damage=damage,
     53                                   damage=damage, bullet_type=bullet_type,
    5454                                   source_collision_type=source_collision_type)
    5555
  • nagslang/game_object.py

    r362 r363  
    431431
    432432class Bullet(GameObject):
    433     def __init__(self, space, position, impulse, damage,
     433    def __init__(self, space, position, impulse, damage, bullet_type,
    434434                 source_collision_type):
    435435        body = make_body(1, pymunk.inf, position)
     436        body.angle = impulse.angle
    436437        self.last_position = position
    437438        self.shape = pymunk.Circle(body, 2)
     
    439440        self.shape.collision_type = COLLISION_TYPE_PROJECTILE
    440441        self.damage = damage
     442        self.type = bullet_type
    441443        self.source_collision_type = source_collision_type
    442444        super(Bullet, self).__init__(
    443445            SingleShapePhysicser(space, self.shape),
    444             render.ImageRenderer(resources.get_image('objects', 'bullet.png')),
     446            render.ImageRenderer(resources.get_image(
     447                'objects', '%s.png' % self.type)),
    445448        )
    446449        self.physicser.apply_impulse(impulse)
  • nagslang/protagonist.py

    r361 r363  
    300300        vec = vec_from_angle(self.angle, BULLET_SPEED)
    301301        FireEvent.post(
    302             self.physicser.position, vec, BULLET_DAMAGE, COLLISION_TYPE_PLAYER)
     302            self.physicser.position, vec, BULLET_DAMAGE, 'bullet',
     303            COLLISION_TYPE_PLAYER)
    303304
    304305    def claw(self):
  • nagslang/screens/area.py

    r347 r363  
    179179        elif FireEvent.matches(ev):
    180180            bullet = Bullet(self.space, ev.source, ev.impulse, ev.damage,
    181                             ev.source_collision_type)
     181                            ev.bullet_type, ev.source_collision_type)
    182182            self._drawables.add(bullet)
    183183        elif EnemyDeathEvent.matches(ev):
Note: See TracChangeset for help on using the changeset viewer.