Beispiel #1
0
    def Play(self):
        for s in self.sounds:
            if s.position == 0:
                s.Play()
                return

        s = ika.Sound(self.fname)
        s.loop = False
        s.Play()
        self.sounds.append(s)
Beispiel #2
0
def playMusic(fname):
    if fname in music:
        m = music[fname]
    else:
        m = ika.Sound(fname)
        m.loop = True
        music[fname] = m

    fader.reset(m)
    if fader not in system.engine.things:
        system.engine.things.append(fader)
Beispiel #3
0
 def __init__(self, fname):
     self.fname = fname
     self.sounds = [ika.Sound(fname)]
     self.sounds[0].loop = False
Beispiel #4
0
dodge = RepeatableSound('sfx/dodge.ogg')

achievement = RepeatableSound('sfx/LevelUp.wav')

menuClick = RepeatableSound('sfx/MenuClick.wav')
menuBuzz = RepeatableSound('sfx/MenuBuzz.wav')

hearthRend = RepeatableSound('sfx/HearthRend.wav')
crushingGale = RepeatableSound('sfx/CrushingGale.wav')
healingRain = RepeatableSound('sfx/HealingRain.wav')
#boltStorm = RepeatableSound('sfx/bolt2.wav')
boltStorm = RepeatableSound('sfx/slash3.wav')

monsterHit = RepeatableSound('sfx/MonsterHit.wav')

anklebiterStrike = ika.Sound('sfx/AnklebiterStrike.wav')
anklebiterHurt = NullSound()  # ika.Sound('sfx/AnklebiterHurt.wav')
anklebiterDie = RepeatableSound('sfx/AnklebiterDie.wav')

beam = RepeatableSound('sfx/beam.wav')
serpentRoar = RepeatableSound('sfx/serpentroar.wav')
serpentDie = RepeatableSound('sfx/serpentdie.wav')

yetiStrike = [NullSound(), NullSound()]
yetiHurt = [[ika.Sound('sfx/YetiHurt%i.wav' % i) for i in range(1, 4)],
            [ika.Sound('sfx/SoulReaverHurt%i.wav' % i) for i in range(1, 4)]]
yetiDie = [ika.Sound('sfx/YetiDie.wav'), ika.Sound('sfx/SoulReaverDie.wav')]

razorManeStrike = RepeatableSound('sfx/RazormaneStrike.wav')
razorManeHurt = RepeatableSound('sfx/RazormaneHurt.wav')
razorManeDie = RepeatableSound('sfx/RazormaneDie.wav')
Beispiel #5
0
subscreen.init()


try:
    c = controls.readConfig('controls.cfg')
except IOError: #file not found, write defaults to a config file and reload it
    c = controls.defaultControls
    controls.writeConfig('controls.cfg', c)
try: 
    controls.setConfig(c)
except: 
    controls.writeConfig('controls_bak.cfg', c)
    controls.setConfig(controls.defaultControls) #any fails (missing gamepad usually), default to original controls


introMusic = ika.Sound('music/Existing.s3m')
#while not controls.attack():
#        ika.Video.DrawRect(0,0,320,240,0)
#        ika.Video.ShowPage()
#        ika.Input.Update()
sound.fader.kill()
#ika.Delay(5)
introMusic.Play()
#ika.Delay(5)
intro()

    
while True:        
        killmusic=True
        if saveload.quicksave:
            result = 3
Beispiel #6
0
#
# There is no warranty, express or implied on the functionality, or
# suitability of this code for any purpose.
import ika

class NullSound(object):
    'Sound stub.  Behaves like an ika sound object, but does nothing.'
    def Play(*args):
        'Does nothing.'
        pass
    def Pause(*args):
        'Does nothing.'
        pass

null = NullSound()

# Simply assign these to a new value to add sound to the menus and
# such.  Be sure you don't use the from sounds import * form when you
# import, or it won't work.
cursormove = ika.Sound('sounds/menumov.ogg')
cursoraccept = ika.Sound('sounds/menusel.ogg')
cursorcancel = null
buzz = null
buysell = null

# nuking everything in the namespace except the sounds themselves.
# that way, in the unusual occurance that you need a dict of all the UI sounds
# you can just use __dict__.
del null
del NullSound
Beispiel #7
0
def credits():
    m = sound.music.get('music/Existing.s3m', ika.Sound('music/Existing.s3m'))
    m.loop = True
    sound.fader.kill()
    sound.fader.reset(m)

    bg = ika.Image('gfx/mountains2.png')
    snow = Snow(velocity=(0.5, 0.75))
    y = -ika.Video.yres
    font = ika.Font('system.fnt')
    totalitems = 27  #total collectable items - tnt, + all types of runes
    #currently 6 of each rune type 18 total, + 4 main runes + 5 TNT = 27
    s = system.engine.player.stats

    collecteditems = s.totaltnt + s.powerrunes + s.strengthrunes + s.guardrunes + 4  #hack - assume that all 4 main runes are collected :P
    itempercent = str(round(collecteditems * 100 / totalitems, 1)) + '%'
    if automap.map.getMapPct() >= 100:
        mappercent = '100.0%'
    else:
        mappercent = str(automap.map.getMapPct()) + '%'
    totaltxt = _basetext + """ *** Final Stats ***
    
    
  Total Time Played:  """ + system.engine.time + """    
Item Collection Rate:  """ + itempercent + """
Map Completion Rate:  """ + mappercent + """


"""

    _text = totaltxt.split('\n')

    class CreditEnt(object):
        def __init__(self, e, name, x, y, h):
            self.ent = e
            self.name = name
            self.x = x
            self.y = y
            self.h = int(h / 2)  #display line at midpoint of image height
            if self.name == 'soulreaver':
                self.displayname = 'Rune Guardian'  #hack
            else:
                self.displayname = name.capitalize()

            self.num = str(system.engine.player.stats[self.name])

        def draw(self, offset):
            self.ent.Draw(self.x, self.y - offset)

            font.Print(140, self.y - offset + self.h, self.displayname)
            font.Print(250, self.y - offset + self.h, self.num)

    def draw():
        ika.Video.Blit(bg, 0, 0, ika.Opaque)
        ika.Video.DrawRect(0, 0, ika.Video.xres, ika.Video.yres,
                           ika.RGB(0, 0, 0, 128), True)

        firstLine = int(y) / font.height
        adjust = int(y) % font.height
        length = (ika.Video.yres / font.height) + 1

        Y = -adjust
        while Y < ika.Video.yres and firstLine < len(_text):
            if firstLine >= 0:
                font.CenterPrint(160, Y, _text[firstLine])
            Y += font.height
            firstLine += 1

        for en in entlist:
            en.draw(int(y))

        ika.Video.DrawTriangle((0, 0, ika.RGB(0, 0, 0)),
                               (ika.Video.xres, 0, ika.RGB(0, 0, 0, 0)),
                               (0, 60, ika.RGB(0, 0, 0, 0)))

        ika.Video.DrawTriangle(
            (ika.Video.xres, ika.Video.yres, ika.RGB(0, 0, 0)),
            (0, ika.Video.yres, ika.RGB(0, 0, 0, 0)),
            (ika.Video.xres, ika.Video.yres - 60, ika.RGB(0, 0, 0, 0)))

        snow.draw()

    entlist = []

    startx = 80
    starty = 0
    for i, txt in enumerate(_text):
        if '*** Enemy Stats ***' in txt:
            starty = i * 10 + 30
            break

    #hack because the full sprite dimensions aren't directly accessible
    heights = [16] * 3 + [32] * 3 + [72] * 3 + [112]
    halfwidths = [8] * 3 + [16] * 3 + [48] * 4
    offseth = [0] * 3 + [0] * 3 + [16] * 3 + [15]  #compensate for hotspot

    for i, entname in enumerate([
            'anklebiter', 'carnivore', 'devourer', 'razormane', 'dragonpup',
            'hellhound', 'yeti', 'gorilla', 'soulreaver', 'serpent'
    ]):
        e = ika.Entity(-100, -100, 2,
                       entname + '.ika-sprite')  #put it off screen!
        entlist.append(
            CreditEnt(e, entname, startx - halfwidths[i], starty - offseth[i],
                      heights[i]))
        starty += heights[i] + 10

    maxy = len(_text) * 10

    draw()
    xi.effects.fadeIn(50)

    now = ika.GetTime()
    while True:
        t = ika.GetTime()
        delta = (t - now) / 5.0
        y += delta
        now = t
        snow.update()
        draw()
        ika.Video.ShowPage()
        ika.Input.Update()
        if y > maxy:
            break

    system.killmusic = False  #keep music playing after returning to menu

    raise EndGameException
Beispiel #8
0
class Sound(NullSound):
    'temp'

    def __init__(self, fname):
        pass

    def Play(self):
        pass


# sound effects ---------------------------------------------------------------------

# TOOLS (BATTLE)
sword1, sword2, sword3 = [
    ika.Sound('sounds/sword%i.ogg' % i) for i in range(1, 4)
]
spear1, spear2, spear3 = [
    ika.Sound('sounds/spear%i.ogg' % i) for i in range(1, 4)
]
spearCharged = ika.Sound('sounds/spear2.ogg')
spearCharged.pitchshift = 1.125  #range from 0.5 to 2.0, default 1.0
grapple1, grapple2 = [
    ika.Sound('sounds/grapple%i.ogg' % i) for i in range(1, 3)
]

# HIT (BATTLE)
playerHit = ika.Sound('sounds/playerhit.ogg')
enemyHit = ika.Sound('sounds/enemyhit.ogg')
sporeHit = ika.Sound('sounds/sporehit.ogg')
maneaterHit = ika.Sound('sounds/maneaterhit.ogg')