Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Randomize
- On Error Resume Next
- ExecuteGlobal GetTextFile("controller.vbs")
- If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
- On Error Goto 0
- Const cGameName="stingray",UseSolenoids=2,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
- LoadVPM "01530000","bally.vbs",3.20
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- If DesktopMode = True Then 'Show Desktop components
- Ramp16.visible=1
- Ramp15.visible=1
- Primitive13.visible=1
- Else
- Ramp16.visible=0
- Ramp15.visible=0
- Primitive13.visible=0
- End if
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(1)= "vpmSolSound SoundFX(""Chime1"",DOFChimes),"
- SolCallback(2)= "vpmSolSound SoundFX(""Chime2"",DOFChimes),"
- SolCallback(3)= "vpmSolSound SoundFX(""Chime3"",DOFChimes),"
- SolCallback(4)= "vpmSolSound SoundFX(""Chime4"",DOFChimes),"
- SolCallback(6)= "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
- SolCallback(7)="bsTrough.SolOut"
- SolCallback(9)="SolSaucerEject"
- SolCallback(10)="dtL.SolDropUp"
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
- Else
- PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
- Else
- PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
- End If
- End Sub
- '**********************************************************************************************************
- 'Solenoid Controlled toys
- '**********************************************************************************************************
- Sub SolSaucerEject(Enabled)
- If Enabled Then
- If bsSaucer1.Balls Then bsSaucer1.ExitSol_On
- If bsSaucer2.Balls Then bsSaucer2.ExitSol_On
- End If
- End Sub
- '*****GI Lights On
- dim xx
- For each xx in GI:xx.State = 1: Next
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough,bsSaucer1,bsSaucer2,dtL
- Sub Table1_Init
- vpmInit Me
- On Error Resume Next
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
- .SplashInfoLine = "StingRay (Stern)"&chr(13)&"You Suck"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 1
- On Error Resume Next
- .Run
- If Err Then MsgBox Err.Description
- On Error Goto 0
- End With
- PinmameTimer.Interval=PinMameInterval
- PinmameTimer.Enabled=1
- vpmNudge.TiltSwitch=7
- vpmNudge.Sensitivity=2
- vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
- Set bsTrough=New cvpmBallstack
- bsTrough.InitNoTrough BallRelease,8,125,3
- bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
- Set bsSaucer1=New cvpmBallStack
- bsSaucer1.InitSaucer sw12,12,180,8
- bsSaucer1.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- bsSaucer1.KickAngleVar=30
- bsSaucer1.KickForceVar = 2
- Set bsSaucer2=New cvpmBallStack
- bsSaucer2.InitSaucer sw12a,12,207,10
- bsSaucer2.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
- bsSaucer2.KickAngleVar=15
- bsSaucer2.KickForceVar = 2
- Set dtL=New cvpmDropTarget
- dtL.InitDrop Array(sw25,sw26,sw27,sw28,sw29),Array(25,26,27,28,29)
- dtL.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
- End Sub
- '**********************************************************************************************************
- 'Plunger code
- '**********************************************************************************************************
- Sub Table1_KeyDown(ByVal KeyCode)
- If KeyDownHandler(keycode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
- End Sub
- Sub Table1_KeyUp(ByVal KeyCode)
- If KeyUpHandler(keycode) Then Exit Sub
- If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
- End Sub
- '**********************************************************************************************************
- ' Drain hole
- Sub Drain_Hit:playsound"drain":bsTrough.addball me:End Sub
- Sub sw12_Hit:bsSaucer1.AddBall 0 : playsound "popper_ball": End Sub
- Sub sw12a_Hit:bsSaucer2.AddBall 0 : playsound "popper_ball": End Sub
- 'Drop Targets
- Sub sw25_Dropped:dtL.Hit 1:End Sub
- Sub sw26_Dropped:dtL.Hit 2:End Sub
- Sub sw27_Dropped:dtL.Hit 3:End Sub
- Sub sw28_Dropped:dtL.Hit 4:End Sub
- Sub sw29_Dropped:dtL.Hit 5:End Sub
- 'Stand Up Targets
- Sub sw30_Hit:vpmTimer.PulseSw 30:DOF 101, DOFPulse:End Sub
- Sub sw30f_Hit:vpmTimer.PulseSw 30:DOF 102, DOFPulse:End Sub
- Sub sw32a_Hit:vpmTimer.PulseSw 32:DOF 104, DOFPulse:End Sub
- 'Wire Triggers
- Sub SW23_Hit:Controller.Switch(23)=1 : playsound"rollover" : End Sub
- Sub SW23_UnHit:Controller.Switch(23)=0:End Sub
- Sub SW24_Hit:Controller.Switch(24)=1 : playsound"rollover" : End Sub
- Sub SW24_UnHit:Controller.Switch(24)=0:End Sub
- Sub SW31_Hit:Controller.Switch(31)=1 : playsound"rollover" : End Sub
- Sub SW31_UnHit:Controller.Switch(31)=0:End Sub
- Sub SW32_Hit:Controller.Switch(32)=1 : playsound"rollover" : DOF 105, DOFOn : End Sub
- Sub SW32_UnHit:Controller.Switch(32)=0 : DOF 105, DOFOff : End Sub
- 'Spinners
- Sub sw30g_Spin:vpmTimer.PulseSw 30 : playsound"fx_spinner" : DOF 103, DOFPulse : End Sub
- 'Scoring Rubbers
- Sub SW21a_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
- Sub SW21b_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
- Sub SW21c_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
- Sub SW21d_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
- Sub SW21e_Hit:vpmTimer.pulseSw 21 : playsound"flip_hit_3" : End Sub
- Sub SW22a_Hit:vpmTimer.pulseSw 22 : playsound"flip_hit_3" : End Sub
- Sub SW22b_Hit:vpmTimer.pulseSw 22 : playsound"flip_hit_3" : End Sub
- 'Star Triggers
- Sub SW14_Hit:Controller.Switch(14)=1 : playsound"rollover" : End Sub
- Sub SW14_unHit:Controller.Switch(14)=0:End Sub
- Sub SW30a_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 110, DOFOn : End Sub
- Sub SW30a_unHit:Controller.Switch(30)=0: DOF 110, DOFOff : End Sub
- Sub SW30b_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 109, DOFOn : End Sub
- Sub SW30b_unHit:Controller.Switch(30)=0: DOF 109, DOFOff : End Sub
- Sub SW30c_Hit:Controller.Switch(30)=1 : playsound"rollover": DOF 108, DOFOn : End Sub
- Sub SW30c_unHit:Controller.Switch(30)=0: DOF 108, DOFOff : End Sub
- Sub SW30d_Hit:Controller.Switch(30)=1 : playsound"rollover" : DOF 107, DOFOn : End Sub
- Sub SW30d_unHit:Controller.Switch(30)=0: DOF 107, DOFOff : End Sub
- Sub SW30e_Hit:Controller.Switch(30)=1 : playsound"rollover" : DOF 106, DOFOn : End Sub
- Sub SW30e_unHit:Controller.Switch(30)=0: DOF 106, DOFOff : End Sub
- 'Bumpers
- Sub Bumper1_Hit:vpmTimer.PulseSw 39 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
- Sub Bumper2_Hit:vpmTimer.PulseSw 40 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
- Sub Bumper3_Hit:vpmTimer.PulseSw 38 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
- Set Lights(1)=L1
- Lights(2)= array(L2,l2a)
- Set Lights(3)=L3
- Lights(9)= array(L9,L9a)
- Lights(10)= array(L10,L10a)
- Set Lights(11)=L11
- Lights(12)= array(L12,L12a,L12b,L12c)
- Set Lights(17)=L17
- Set Lights(18)=L18
- Set Lights(19)=L19
- Set Lights(20)=L20
- Set Lights(21)=L21
- Lights(25)= array(L25,L25a)
- Set Lights(33)=L33
- Set Lights(34)=L34
- Set Lights(38)=L38
- Lights(41)= array(L41,l41a)
- Set Lights(44)=L44
- Set Lights(49)=L49
- Set Lights(50)=L50
- Lights(52)= array(L52,L52a)
- Set Lights(53)=L53
- Set Lights(57)=L57
- Set Lights(58)=L58
- '**********************************************************************************************************
- 'Digital Display
- '**********************************************************************************************************
- Dim Digits(28)
- ' 1st Player
- Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
- Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
- Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
- Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
- Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
- Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
- ' 2nd Player
- Digits(6) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
- Digits(7) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
- Digits(8) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
- Digits(9) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
- Digits(10) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
- Digits(11) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
- ' 3rd Player
- Digits(12) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
- Digits(13) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
- Digits(14) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
- Digits(15) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
- Digits(16) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
- Digits(17) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
- ' 4th Player
- Digits(18) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
- Digits(19) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
- Digits(20) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
- Digits(21) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
- Digits(22) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
- Digits(23) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
- ' Credits
- Digits(24) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
- Digits(25) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
- ' Balls
- Digits(26) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
- Digits(27) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
- Sub DisplayTimer_Timer
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- If Not IsEmpty(ChgLED) Then
- If DesktopMode = True Then
- For ii = 0 To UBound(chgLED)
- num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- if (num < 28) then
- For Each obj In Digits(num)
- If chg And 1 Then obj.State = stat And 1
- chg = chg\2 : stat = stat\2
- Next
- else
- 'if char(stat) > "" then msg(num) = char(stat)
- end if
- next
- end if
- end if
- End Sub
- '**********************************************************************************************************
- '**********************************************************************************************************
- 'Stern Stingray
- 'added by Inkochnito
- Sub editDips
- Dim vpmDips : Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700,400,"Stingray - DIP switches"
- .AddFrame 2,0,190,"Maximum credits",&H00070000,Array("10 credits",&H00010000,"20 credits",&H00030000,"30 credits",&H00050000,"40 credits",&H00070000)'dip 17&18&19
- .AddFrame 2,76,190,"High game to date award",&H00004000,Array("3 balls - 500K, 5 balls - 840K",0,"3 free games",&H00004000)'dip 15
- .AddFrame 2,122,190,"High score award",&H00000020,Array("extra ball",0,"replay",&H00000020)'dip 6
- .AddFrame 2,168,190,"Balls per game",&H00000040,Array("3 balls",0,"5 balls",&H00000040)'dip 7
- .AddChk 2,220,120,Array("Credits displayed",&H00080000)'dip 20
- .AddChk 2,235,120,Array("Match feature",&H00100000)'dip 21
- .AddChk 2,250,120,Array("4 player games",&H01000000)'dip 25
- .AddFrame 205,0,190,"Special award",&HC0000000,Array("100.000 points",0,"free ball",&H40000000,"free game",&H80000000,"free ball and free game",&HC0000000)'dip 31&32
- .AddFrame 205,76,190,"Feature lites adjustment",32768,Array("all lites on",0,"lites alternating",32768)'dip 16
- .AddFrame 205,122,190,"Drop target special",&H00800000,Array("special lite on only",0,"special lite on and 1 replay",&H00800000)'dip 24
- .AddFrame 205,168,190,"Melody option",&H00000080,Array("2 tones only",0,"full melody",&H00000080)'dip 8
- .AddLabel 50,270,300,20,"After hitting OK, press F3 to reset game with new settings."
- .ViewDips
- End With
- End Sub
- Set vpmShowDips = GetRef("editDips")
- ' *********************************************************************
- ' *********************************************************************
- 'Start of VPX call back Functions
- ' *********************************************************************
- ' *********************************************************************
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw 36
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.rotx = 20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- vpmTimer.PulseSw 37
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.rotx = 20
- LStep = 0
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.y * 2 / table1.height-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / table1.width-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '*****************************************
- ' JP's VP10 Rolling Sounds
- '*****************************************
- Const tnob = 5 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- If BOT(b).X < Table1.Width/2 Then
- BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 12
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called RollingTimer. With a fast interval, like 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
- ' according to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The collision is built in VP.
- ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
- ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
- ' depending of the speed of the collision.
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement