def hit_dmg(g, a, b, top=1, right=1, bottom=1, left=1):
    r, cur, prev = a.rect, b.rect, b.prev

    got_hit = False

    if top and prev.bottom <= r.top and cur.bottom > r.top:
        got_hit = True
        cur.bottom = r.top
        if hasattr(b, 'standing'): b.standing = a
    if right and prev.left >= r.right and cur.left < r.right:
        got_hit = True
        cur.left = r.right
    if bottom and prev.top >= r.bottom and cur.top < r.bottom:
        got_hit = True
        cur.top = r.bottom
        # if hasattr(b,'vy'): b.vy = 0
        if hasattr(b, 'standing') and b.standing != None:
            import sprite
            sprite.stop_standing(g, b)
    if left and prev.right <= r.left and cur.right > r.left:
        got_hit = True
        cur.right = r.left

    # if got_hit and 'shoot' in b.groups:
    #   b.active = False
    #
    # if got_hit and 'laser' in b.groups:
    #   b.active = False

    player.damage(g, b, a)
Example #2
0
def hit(g, a, b):
    player.damage(g, b, a)
    # a.active = False

    b.strength -= a.strength
    if b.strength <= 0:
        # b.active = False
        code = None
        if hasattr(b, '_code'):
            code = b._code
            delattr(b, '_code')

        explode(g, b)
Example #3
0
def hit(g, a, b):
    player.damage(g, b, a)
    a.active = False
Example #4
0
def hit(g, a, b):
    player.damage(g, b, a)
Example #5
0
 def hit(self, a, b):
     player.damage(self.game, b)
Example #6
0
def hit(g,a,b):
    player.damage(g,b)
    #print 'youve been spikeys!'
    pass
Example #7
0
def hit(g,a,b):
    player.damage(g,b)
Example #8
0
def hit(g, a, b):
    player.damage(g, b)
    #print 'youve been spikeys!'
    pass
Example #9
0
def hit(g, a, b):
    player.damage(g, b, a)
    a.active = False