From 80225fead703db9a5ffed86b1bd3fb004e3005aa Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 15 Nov 2005 23:47:10 +0000 Subject: Added pause mode --- sounds.bmx | 257 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 139 insertions(+), 118 deletions(-) (limited to 'sounds.bmx') diff --git a/sounds.bmx b/sounds.bmx index c0bdf5d..1c7ffe0 100644 --- a/sounds.bmx +++ b/sounds.bmx @@ -1,118 +1,139 @@ -' Vectoroids -' -' Copyright 2005 Ian Cowburn -' -' $Id$ -' -Strict - -Incbin "SFX/explode1.wav" -Incbin "SFX/explode2.wav" -Incbin "SFX/explode3.wav" -Incbin "SFX/fire.wav" -Incbin "SFX/life.wav" -Incbin "SFX/lsaucer.wav" -Incbin "SFX/sfire.wav" -Incbin "SFX/ssaucer.wav" -Incbin "SFX/thrust.wav" -Incbin "SFX/thumphi.wav" -Incbin "SFX/thumplo.wav" - - -Type Sounds - Global explode:TSound[] - Global fire:TSound - Global life:TSound - Global lsaucer:TSound - Global sfire:TSound - Global ssaucer:TSound - Global thrust:TSound - Global thumphi:TSound - Global thumplo:TSound - - Global thrust_channel:TChannel - Global ssaucer_channel:TChannel - Global lsaucer_channel:TChannel - - Global frame:Int - Global hi:Int - - Function Init() - explode=New TSound[3] - explode[2]=LoadSound("incbin::SFX/explode1.wav") - explode[1]=LoadSound("incbin::SFX/explode2.wav") - explode[0]=LoadSound("incbin::SFX/explode3.wav") - fire=LoadSound("incbin::SFX/fire.wav") - life=LoadSound("incbin::SFX/life.wav") - lsaucer=LoadSound("incbin::SFX/lsaucer.wav",True) - sfire=LoadSound("incbin::SFX/sfire.wav") - ssaucer=LoadSound("incbin::SFX/ssaucer.wav",True) - thrust=LoadSound("incbin::SFX/thrust.wav",True) - thumplo=LoadSound("incbin::SFX/thumplo.wav") - thumphi=LoadSound("incbin::SFX/thumphi.wav") - - frame=0 - hi=True - - thrust_channel=thrust.Cue() - ssaucer_channel=ssaucer.Cue() - lsaucer_channel=lsaucer.Cue() - End Function - - Function Update(freq:Int) - If frame>freq - frame=0 - - If hi - thumphi.Play() - Else - thumplo.Play() - EndIf - - hi=Not hi - EndIf - frame:+1 - End Function - - Function AsteroidExplosion(size:Int) - explode[size].Play() - End Function - - Function ShipExplosion() - explode[0].Play() - End Function - - Function PlayerFire() - fire.Play() - End Function - - Function SaucerFire() - sfire.Play() - End Function - - Function ExtraLife() - life.Play() - End Function - - Function PlayerThrust(on:Int) - thrust_channel.SetPaused(Not on) - End Function - - Function SmallSaucer() - ssaucer_channel.SetPaused(False) - End Function - - Function LargeSaucer() - lsaucer_channel.SetPaused(False) - End Function - - Function NoSaucer() - lsaucer_channel.SetPaused(True) - ssaucer_channel.SetPaused(True) - End Function - - Function Clear() - PlayerThrust(False) - NoSaucer() - End Function -End Type +' Vectoroids +' +' Copyright 2005 Ian Cowburn +' +' $Id$ +' +Strict + +Incbin "SFX/explode1.wav" +Incbin "SFX/explode2.wav" +Incbin "SFX/explode3.wav" +Incbin "SFX/fire.wav" +Incbin "SFX/life.wav" +Incbin "SFX/lsaucer.wav" +Incbin "SFX/sfire.wav" +Incbin "SFX/ssaucer.wav" +Incbin "SFX/thrust.wav" +Incbin "SFX/thumphi.wav" +Incbin "SFX/thumplo.wav" + + +Type Sounds + Global explode:TSound[] + Global fire:TSound + Global life:TSound + Global lsaucer:TSound + Global sfire:TSound + Global ssaucer:TSound + Global thrust:TSound + Global thumphi:TSound + Global thumplo:TSound + + Global thrust_channel:TChannel + Global ssaucer_channel:TChannel + Global lsaucer_channel:TChannel + + Global frame:Int + Global hi:Int + + Global thrust_on:Int + Global small_on:Int + Global large_on:Int + + Function Init() + explode=New TSound[3] + explode[2]=LoadSound("incbin::SFX/explode1.wav") + explode[1]=LoadSound("incbin::SFX/explode2.wav") + explode[0]=LoadSound("incbin::SFX/explode3.wav") + fire=LoadSound("incbin::SFX/fire.wav") + life=LoadSound("incbin::SFX/life.wav") + lsaucer=LoadSound("incbin::SFX/lsaucer.wav",True) + sfire=LoadSound("incbin::SFX/sfire.wav") + ssaucer=LoadSound("incbin::SFX/ssaucer.wav",True) + thrust=LoadSound("incbin::SFX/thrust.wav",True) + thumplo=LoadSound("incbin::SFX/thumplo.wav") + thumphi=LoadSound("incbin::SFX/thumphi.wav") + + frame=0 + hi=True + + thrust_channel=thrust.Cue() + ssaucer_channel=ssaucer.Cue() + lsaucer_channel=lsaucer.Cue() + End Function + + Function Update(freq:Int) + If frame>freq + frame=0 + + If hi + thumphi.Play() + Else + thumplo.Play() + EndIf + + hi=Not hi + EndIf + frame:+1 + End Function + + Function AsteroidExplosion(size:Int) + explode[size].Play() + End Function + + Function ShipExplosion() + explode[0].Play() + End Function + + Function PlayerFire() + fire.Play() + End Function + + Function SaucerFire() + sfire.Play() + End Function + + Function ExtraLife() + life.Play() + End Function + + Function PlayerThrust(on:Int) + thrust_channel.SetPaused(Not on) + thrust_on=on + End Function + + Function SmallSaucer() + ssaucer_channel.SetPaused(False) + small_on=True + End Function + + Function LargeSaucer() + lsaucer_channel.SetPaused(False) + large_on=True + End Function + + Function NoSaucer() + lsaucer_channel.SetPaused(True) + ssaucer_channel.SetPaused(True) + small_on=False + large_on=False + End Function + + Function Clear() + PlayerThrust(False) + NoSaucer() + End Function + + Function Pause() + thrust_channel.SetPaused(True) + ssaucer_channel.SetPaused(True) + lsaucer_channel.SetPaused(True) + End Function + + Function EndPause() + thrust_channel.SetPaused(Not thrust_on) + ssaucer_channel.SetPaused(Not small_on) + lsaucer_channel.SetPaused(Not large_on) + End Function +End Type -- cgit v1.2.3