Changeset 370:92cf515a6cf6


Ignore:
Timestamp:
04/09/11 12:53:33 (12 years ago)
Author:
Adrianna Pińska <adrianna.pinska@…>
Branch:
default
Parents:
369:f14621568fb6 (diff), 366:249ba3bd6904 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/sprites/base.py

    r366 r370  
    3030        Sprite.__init__(self)
    3131        self._starting_tile_pos = pos
     32        self.setup(**opts)
    3233        self.setup_image_data(pos)
    33         self.setup(**opts)
    3434
    3535    def setup(self):
  • skaapsteker/sprites/base.py

    r367 r370  
    237237    DAMAGE = 10
    238238
    239     def setup(self, hits):
     239    PROJECTILE_SIZE = (0, 0) # pixels
     240    VELOCITY = (10, 10) # pixels/s
     241
     242    def setup(self, direction, hits, **opts):
     243        super(Projectile, self).setup(**opts)
     244        self.facing = direction
     245
    240246        if isinstance(hits, tuple):
    241247            self.hits = hits + (Geography,)
    242248        else:
    243249            self.hits = (hits, Geography)
     250
     251        if self.facing == "left":
     252            shift = (-self.PROJECTILE_SIZE[0] / 2, self.PROJECTILE_SIZE[1])
     253            dv = (-self.VELOCITY[0], self.VELOCITY[1])
     254        else:
     255            shift = (self.PROJECTILE_SIZE[0] / 2, self.PROJECTILE_SIZE[1])
     256            dv = (self.VELOCITY[0], self.VELOCITY[1])
     257
     258        self.rect.move_ip(shift)
     259        self.collide_rect.move_ip(shift)
     260        self.deltav(dv)
    244261
    245262    def explode(self):
Note: See TracChangeset for help on using the changeset viewer.