view skaapsteker/sprites/projectiles.py @ 538:c1b0ad1c0932

Hook up projectile sounds.
author Simon Cross <hodgestar@gmail.com>
date Sun, 10 Apr 2011 00:33:06 +0200
parents 64d8e49e9a86
children
line wrap: on
line source

"""Things people throw at each other."""

from pygame import transform

from .base import Projectile


class Fireball(Projectile):

    gravitates = True

    launch_sound = 'sounds/woosh fireball.ogg', 0.5
    image_dir = 'sprites/attacks/fireball'
    animation_regexes = [
        ("raining_death", r"^fireball-\d+-sm.png$"),
    ]

    facings = {
        "raining_death" : (
            ('left', None),
            ('right', lambda x: transform.flip(x, True, False))),
    }

    PROJECTILE_SIZE = (55, 8) # pixels
    VELOCITY = (300, -1000) # pps


class Lightning(Projectile):

    gravitates = False
    friction_coeff = (1.2, 1.2) # negative friction

    launch_sound = 'sounds/lightning.ogg', 0.25
    image_dir = 'sprites/attacks'
    animation_regexes = [
        ('frightening', r"^lightning.png$"),
    ]

    facings = {
        "frightening" : (
            ('left', None),
            ('right', lambda x: transform.flip(x, True, False))),
    }

    PROJECTILE_SIZE = (55, 8) # pixels
    VELOCITY = (400, 0) # pps


class EnergyDrain(Projectile):

    gravitates = False
    friction_coeff = (1.0, 1.0) # no friction

    launch_sound = 'sounds/woosh.ogg', 0.5
    image_dir = 'sprites/attacks'
    animation_regexes = [
        ('draining', r"^energy_drain.png$"),
    ]

    facings = {
        "frightening" : (
            ('left', None),
            ('right', lambda x: transform.flip(x, True, False))),
    }

    PROJECTILE_SIZE = (55, 8) # pixels
    VELOCITY = (400, 0) # pps