Changeset 101:93aa745d57ff for nagslang
- Timestamp:
- Sep 2, 2013, 10:45:06 AM (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nagslang/protagonist.py
r94 r101 1 1 import pymunk 2 2 import pymunk.pygame_util 3 4 import pygame 3 5 4 6 from nagslang.constants import COLLISION_TYPE_PLAYER … … 6 8 GameObject, SingleShapePhysicser, FacingImageRenderer) 7 9 from nagslang.mutators import FLIP_H 10 from nagslang.options import options 8 11 from nagslang.resources import resources 9 12 … … 133 136 134 137 def render(self, surface): 135 # Uncomment to draw pymunk shape as well: 136 # pymunk.pygame_util.draw(surface, self._shapes[self.form]) 138 if options.debug: 139 # Less general that pymunk.pygame_utils.draw, but also a 140 # lot less noisy 141 color = pygame.color.THECOLORS['lightblue'] 142 if hasattr(self._shapes[self.form], 'get_vertices'): 143 # polygon bounding box 144 points = [pymunk.pygame_util.to_pygame(p, surface) 145 for p in self._shapes[self.form].get_vertices()] 146 pygame.draw.lines(surface, color, True, points, 2) 147 else: 148 # draw the circle 149 centre = pymunk.pygame_util.to_pygame( 150 self._shapes[self.form].body.position, surface) 151 radius = int(self._shapes[self.form].radius) 152 pygame.draw.circle(surface, color, centre, radius, 2) 137 153 super(Protagonist, self).render(surface)
Note: See TracChangeset
for help on using the changeset viewer.