Ignore:
Timestamp:
09/04/13 16:40:00 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Much better facing renderers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/enemies.py

    r218 r229  
     1import math
     2
    13import pymunk
    24import pymunk.pygame_util
     
    6668
    6769    def get_render_angle(self):
    68         return self.angle
     70        # No image rotation when rendering, please.
     71        return 0
     72
     73    def get_facing_direction(self):
     74        # Enemies can face left or right.
     75        if - math.pi / 2 < self.angle <= math.pi / 2:
     76            return 'right'
     77        else:
     78            return 'left'
    6979
    7080    def _switch_direction(self):
Note: See TracChangeset for help on using the changeset viewer.