Changeset 376:4d6198b68cb9


Ignore:
Timestamp:
04/09/11 13:06:49 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Rebase:
30663732393462386531336664376334323430626239646261306664636239653866393135306332
Message:

Add projectile launching method to monsters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/sprites/base.py

    r374 r376  
    99from ..physics import Sprite
    1010from ..constants import Layers
    11 from ..engine import OpenDialog
     11from ..engine import OpenDialog, AddSpriteEvent
    1212from .. import data
    1313from .. import dialogue
     
    175175                self.do_attack()
    176176
     177    def _launch_projectile(self, cls):
     178        from .player import Player # avoid circular imports
     179        if self.facing == 'left':
     180            pos = pygame.Rect(self.rect.midleft, (0, 0))
     181        else:
     182            pos = pygame.Rect(self.rect.midright, (0, 0))
     183        projectile = cls(pos, direction=self.facing, hits=Player)
     184        AddSpriteEvent.post(projectile)
     185
    177186    def do_attack(self):
    178187        """Overriden by monster classes"""
Note: See TracChangeset for help on using the changeset viewer.