diff options
Diffstat (limited to 'sounds.bmx')
-rw-r--r-- | sounds.bmx | 257 |
1 files changed, 139 insertions, 118 deletions
@@ -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
|