Ignore:
Timestamp:
Sep 6, 2013, 8:27:08 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Use timers for enemy ballistics cooldown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/enemies.py

    r368 r372  
    4343        self.world = world
    4444        self.angle = 0
    45         self._last_fired = 0
    4645
    4746    def make_physics(self, space, position):
     
    9998            return
    10099
    101         if self.lifetime - self._last_fired >= reload_time:
     100        if not self.check_timer('reload_time'):
     101            self.start_timer('reload_time', reload_time)
    102102            vec = Vec2d((target.x - pos.x, target.y - pos.y))
    103103            if vec.length < range_:
     
    105105                FireEvent.post(pos, vec, damage, type_,
    106106                               COLLISION_TYPE_ENEMY)
    107                 self._last_fired = self.lifetime
    108107
    109108    def greedy_move(self, target):
Note: See TracChangeset for help on using the changeset viewer.