Changeset 307:c2bbb1e70d6f


Ignore:
Timestamp:
Sep 5, 2013, 10:32:38 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
359c4a34f777a48a070b865e69f45b3f8a2b8437
Message:

Rename animate to update and pass seconds, for future fun

Location:
nagslang
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • nagslang/enemies.py

    r305 r307  
    111111            (dx * self.impulse_factor, dy * self.impulse_factor))
    112112
    113     def animate(self):
     113    def update(self, seconds):
    114114        # Calculate the step every frame
    115115        if self._direction == 'away':
     
    134134            self._switch_direction()
    135135        self.set_direction(x_step, y_step)
    136         super(PatrollingAlien, self).animate()
     136        super(PatrollingAlien, self).update(seconds)
    137137
    138138    def collide_with_protagonist(self, protagonist):
     
    194194            (dx * self.impulse_factor, dy * self.impulse_factor))
    195195
    196     def animate(self):
     196    def update(self, seconds):
    197197        # Calculate the step every frame
    198198        # Distance to the protagonist
     
    219219            y_step = 0
    220220        self.set_direction(x_step, y_step)
    221         super(ChargingAlien, self).animate()
     221        super(ChargingAlien, self).update(seconds)
    222222
    223223    def collide_with_protagonist(self, protagonist):
  • nagslang/game_object.py

    r305 r307  
    146146        return self.renderer.render(surface)
    147147
    148     def animate(self):
    149         self.renderer.animate()
     148    def update(self, seconds):
     149        self.renderer.update(seconds)
    150150
    151151    def hit(self, weapon):
     
    358358        self.physicser.apply_impulse(impulse)
    359359
    360     def animate(self):
    361         super(Bullet, self).animate()
     360    def update(self, seconds):
     361        super(Bullet, self).update(seconds)
    362362        position = (self.physicser.position.x, self.physicser.position.y)
    363363        r = self.get_space().segment_query(self.last_position, position)
  • nagslang/render.py

    r286 r307  
    3434            self._render_shape(surface)
    3535
    36     def animate(self):
     36    def update(self, seconds):
    3737        # Used by time animatations to advance the clock
    3838        pass
     
    100100        return self._images[self._frame]
    101101
    102     def animate(self):
     102    def update(self, seconds):
    103103        self.advance_tick()
    104104
    105105
    106106class MovementAnimatedRenderer(TimedAnimatedRenderer):
    107     def animate(self):
     107    def update(self, seconds):
    108108        if self.game_object.is_moving:
    109109            self.advance_tick()
     
    128128        return self.renderer.render(surface)
    129129
    130     def animate(self):
    131         return self.renderer.animate()
     130    def update(self, seconds):
     131        return self.renderer.update(seconds)
    132132
    133133    def select_renderer(self):
  • nagslang/screens/area.py

    r305 r307  
    200200        self.tick_protagonist()
    201201        for drawable in self._drawables:
    202             drawable.animate()
     202            drawable.update(seconds)
    203203            if drawable.remove:
    204204                self._drawables.remove(drawable)
  • nagslang/world.py

    r277 r307  
    4343                continue
    4444            # Hack until we save protagonist state
    45             if hasattr(value, 'animate'):
     45            if hasattr(value, 'update'):
    4646                continue
    4747            data[attr] = value
Note: See TracChangeset for help on using the changeset viewer.