Changeset 528:52b38b803782


Ignore:
Timestamp:
04/09/11 22:09:20 (12 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

Skeleton for dead monsters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/sprites/base.py

    r508 r528  
    209209        self.health -= damage
    210210        if self.health <= 0:
     211            AddSpriteEvent.post(Skeleton(self.rect.midbottom))
    211212            self.kill()
    212213
     
    444445
    445446
     447class Skeleton(GameSprite):
     448    mobile = False
     449    gravitates = False
     450    actionable = False
     451    liftable = False
     452    image_dir = 'sprites/skulls/'
     453    debug_color = (255, 255, 0)
     454
     455    def __init__(self, pos, player=False, **opts):
     456        self._pos = pos
     457        if player:
     458            self.image_file = 'kitsune.png'
     459        else:
     460            self.image_file = 'monster.png'
     461        GameSprite.__init__(self, pos, **opts)
     462        self._layer = Layers.FOREGROUND
     463
     464    def setup_image_data(self, pos):
     465        GameSprite.setup_image_data(self, pos)
     466        # Pixel based rect, not tile:
     467        self.rect = self.image.get_rect(midbottom=self._pos)
     468        self.collide_rect = self.rect.move(0, 0)
     469
    446470
    447471def find_sprite(descr, mod_name=None):
Note: See TracChangeset for help on using the changeset viewer.