Exemplo n.º 1
0
def hit_fally(g, a, b, top=1, right=1, bottom=1, left=1):
    hit_block(g, a, b, top, right, bottom, left)

    if not hasattr(b, 'standing'):
        return
    if b.standing != a:
        return

    import tile
    import sprite
    tile.tile_to_sprite(g,a)

    s = a
    s.timer = FPS / 4
    s.image = s.image + 1
    s.hit = hit_block
    s.vy = 0

    def loop(g, s):
        a.timer -= 1
        if a.timer > 0:
            return
        if a.timer == 0:
            g.game.sfx['fally'].play()
        sprite.apply_gravity(g, s)
        s.rect.y += s.vy

    s.loop = loop
Exemplo n.º 2
0
def tile_explode(g, a):
    g.game.sfx['explode'].play()
    tiles.t_put(g, a.pos, 0)
    tile.tile_to_sprite(g, a)
    s = a
    s.hit_groups = set()

    def loop(g, s):
        s.exploded += 2
        if s.exploded > 8:
            s.active = False
            #if s in g.sprites:
                #g.sprites.remove(s)

    s.loop = loop