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="robowars",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="Flipper2",SFlipperOff="Flipper"
- Const SCoin="coin3",cCredits=""
- Const Ballsize = 50
- 'Const BallMass = 1.5
- LoadVPM "01210000", "sys80.vbs", 3.1
- 'LoadVPM "01200000","sys80.vbs",3.2
- Ramp18.visible=0
- Ramp43.visible=0
- wall14.visible=0
- Wall26.visible=0
- Set LampCallback=GetRef("UpdateMultipleLamps")
- gion()
- sub gion()
- gi_1.state=1
- gi_2.state=1
- GI_3.state=1
- GI_4.state=1
- gi_5.state=1
- GI_6.state=1
- GI_7.state=1
- gi_8.state=1
- gi_9.state=1
- GI_10.state=1
- gi_11.state=1
- GI_12.state=1
- gi_13.state=1
- gi_15.state=1
- gi_20.state=1
- gi_21.state=1
- GI_22.state=1
- 'GI_25.state=1
- GI_28.state=1
- GI_29.state=1
- gi_31.state=1
- GI_32.state=1
- GI_34.state=1
- GI_35.state=1
- GI_36.state=1
- GI_43.state=1
- GI_48.state=1
- GI_49.state=1
- GI_50.state=1
- GI_53.state=1
- GI_54.state=1
- End Sub
- sub gioff()
- gi_1.state=0
- gi_2.state=0
- gi_3.state=0
- gi_4.state=0
- gi_5.state=0
- GI_6.state=0
- GI_7.state=0
- gi_8.state=0
- gi_9.state=0
- GI_10.state=0
- gi_11.state=0
- GI_12.state=0
- gi_13.state=0
- gi_15.state=0
- gi_20.state=0
- gi_21.state=0
- GI_22.state=0
- GI_28.state=0
- GI_29.state=0
- gi_31.state=0
- GI_32.state=0
- GI_34.state=0
- GI_35.state=0
- GI_36.state=0
- GI_43.state=0
- GI_48.state=0
- GI_49.state=0
- GI_50.state=0
- GI_53.state=0
- GI_54.state=0
- End Sub
- ball4.CreateSizedBall(25)
- ball4.Kick 180,1
- ball4.enabled=false
- ball5.CreateSizedBall(25)
- ball5.Kick 180,1
- ball5.enabled=false
- '*************************************************************
- 'Solenoid Call backs
- '**********************************************************************************************************
- SolCallback(sLRFlipper) = "SolRFlipper"
- SolCallback(sLLFlipper) = "SolLFlipper"
- SolCallback(1)="sol1" '"DT1.SolDropUp" ' 1 Reset Alpha I / Top Left Flasher 3
- SolCallback(2)="sol2" '"DT2.SolDropUp" ' 2 Reset Alpha II / Top Left Flasher 2
- SolCallback(3)="sol3" '"K3" ' 3 Top Kicker / Stargate Flashers
- SolCallback(4)="sol4" '"K2" ' 4 Right Under-Plastic Flasher
- SolCallback(5)="sol5" '"dt3.SolDropUp" ' 5 Reset Alpha III / Top Left Flasher 1
- SolCallback(6)="sol6" '"dt4.SolDropUp" ' 6 Reset Beta / Top Right Flasher
- SolCallback(7)="sol7" '"vpmFlasher Array(sb1,sb2,sb3,sb4,sb5,sb6,sb7,sb8)," ' 7 Left Under-Plastic Flasher
- SolCallback(8)="vpmSolSound""knocker""," 'knocker
- SolCallback(9)="k4" 'outhole
- sub sol1 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol1.state=1
- Else
- DT1.DropSol_on
- lightsol1.state=0
- end If
- Else
- lightsol1.state=0
- end If
- end Sub
- sub sol2 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol2.state=1
- Else
- DT2.DropSol_on
- lightsol2.state=0
- end If
- Else
- lightsol2.state=0
- end If
- end Sub
- sub sol3 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol3.state=1
- lightsol3a.state=1
- Else
- Kicker3.kick 135,25
- lightsol3.state=0
- lightsol3a.state=0
- end If
- Else
- lightsol3.state=0
- lightsol3a.state=0
- end If
- end Sub
- sub sol4 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol4.state=1
- Else
- 'DT1.DropSol_on
- lightsol4.state=0
- end If
- Else
- lightsol4.state=0
- end If
- end Sub
- sub sol5 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol5.state=1
- Else
- dt3.DropSol_on
- lightsol5.state=0
- end If
- Else
- lightsol5.state=0
- end If
- end Sub
- sub sol6 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol6.state=1
- Else
- dt4.DropSol_on
- lightsol6.state=0
- end If
- Else
- lightsol6.state=0
- end If
- end Sub
- sub sol7 (enabled)
- if enabled Then
- if light12.state =1 Then
- lightsol7.state=1
- Else
- 'DT1.DropSol_on
- lightsol7.state=0
- end If
- Else
- lightsol7.state=0
- end If
- end Sub
- Sub SolOne(Enabled)
- If Enabled Then
- lightsol1.state=1
- lightsol1a.state=1
- Else
- lightsol1.state=0
- lightsol1a.state=0
- End If
- End Sub
- 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
- '**********************************************************************************************************
- Dim FlipperActive
- 'Primitive Flipper
- Sub FlipperTimer_Timer
- FlipperT1.roty = LeftFlipper.currentangle + 237
- FlipperT5.roty = RightFlipper.currentangle + 120
- End Sub
- Dim VarRol, VarHidden
- Dim L4,OL4
- OL4=0
- Sub UpdateMultipleLamps
- 'light15a.State = light15.State
- End Sub
- '**********************************************************************************************************
- 'Initiate Table
- '**********************************************************************************************************
- Dim bsTrough, bsKicker, bsHole, DT1, DT2, dt3, dt4,bssaucer,k1
- Sub Table1_Init
- On Error Resume Next
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
- .SplashInfoLine = "Robo-War"
- .HandleMechanics=0
- .HandleKeyboard=0
- .ShowDMDOnly=1
- .ShowFrame=0
- .ShowTitle=0
- .hidden = 1
- If Err Then MsgBox Err.Description
- End With
- On Error Goto 0
- Controller.SolMask(0)=0
- vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
- Controller.Run
- If Err Then MsgBox Err.Description
- On Error Goto 0
- PinMAMETimer.Interval=PinMAMEInterval
- PinMAMETimer.Enabled=1
- vpmNudge.TiltSwitch=57
- vpmNudge.Sensitivity=5
- vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3)
- Set dt4=New cvpmDropTarget
- dt4.InitDrop Array(Targ4a,Targ4b,Targ4c,Targ4d),Array(40,50,60,70)
- dt4.InitSnd "flapclos","flapopen"
- Set dt3=New cvpmDropTarget
- dt3.InitDrop Array(Targ3a,Targ3b,Targ3c),Array(41,51,61)
- dt3.InitSnd "flapclos","flapopen"
- Set dt2=New cvpmDropTarget
- dt2.InitDrop Array(Targ2a,Targ2b),Array(42,52)
- dt2.InitSnd "flapclos","flapopen"
- Set dt1=New cvpmDropTarget
- dt1.InitDrop Array(Targ1a),Array(43)
- dt1.InitSnd "flapclos","flapopen"
- 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
- '**********************************************************************************************************
- 'Plunger code
- '**********************************************************************************************************
- Sub Table1_KeyDown(ByVal KeyCode)
- If KeyCode=RightFlipperKey Then Controller.Switch(46)=1
- If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
- If vpmKeyDown(KeyCode) Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal KeyCode)
- If KeyCode=RightFlipperKey Then Controller.Switch(46)=0
- If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
- If vpmKeyUp(KeyCode) Then Exit Sub
- End Sub
- '**********************************************************************************************************
- Sub Targ1a_dropped:DT1.Hit 1:End Sub
- Sub Targ2a_dropped:DT2.Hit 1:End Sub
- Sub Targ2b_dropped:DT2.Hit 2:End Sub
- Sub Targ3a_dropped:DT3.Hit 1:End Sub
- Sub Targ3b_dropped:dt3.Hit 2:End Sub
- Sub Targ3c_dropped:dt3.Hit 3:End Sub
- Sub Targ4a_dropped:dt4.Hit 1:End Sub
- Sub Targ4b_dropped:dt4.Hit 2:End Sub
- Sub Targ4c_dropped:dt4.Hit 3:End Sub
- Sub Targ4d_dropped:dt4.Hit 4:End Sub
- Sub sw34_Hit:Controller.Switch(34)=1:End Sub 'switch 34
- Sub sw34_unHit:Controller.Switch(34)=0:End Sub 'switch 34
- Sub sw74_Hit:Controller.Switch(74)=1:End Sub 'switch 74
- Sub sw74_unHit:Controller.Switch(74)=0:End Sub 'switch 74
- Sub sw54_Hit:Controller.Switch(54)=1:End Sub 'switch 54
- Sub sw54_unHit:Controller.Switch(54)=0:End Sub 'switch 54
- Sub sw64_Hit:Controller.Switch(64)=1:End Sub 'switch 64
- Sub sw64_unHit:Controller.Switch(64)=0:End Sub 'switch 64
- Sub sw20_Hit:Controller.Switch(20)=1:End Sub 'switch 20
- Sub sw20_unHit:Controller.Switch(20)=0:End Sub 'switch 20
- Sub sw40_Hit:Controller.Switch(40)=1:End Sub 'switch 40
- Sub sw40_unHit:Controller.Switch(40)=0:End Sub 'switch 40
- Sub sw21_Hit:Controller.Switch(21)=1:End Sub'switch 21
- Sub sw21_unHit:Controller.Switch(21)=0:End Sub'switch 21
- Sub sw55_Hit:Controller.Switch(55)=1:End Sub'switch 55
- Sub sw55_unHit:Controller.Switch(55)=0:End Sub'switch 55
- Sub sw65_Hit:Controller.Switch(65)=1:End Sub'switch 65
- Sub sw65_unHit:Controller.Switch(65)=0:End Sub'switch 65
- Sub sw75_Hit:Controller.Switch(75)=1:End Sub'switch 75
- Sub sw75_unHit:Controller.Switch(75)=0:End Sub'switch 75
- Sub sw66_Hit:Controller.Switch(66)=1:End Sub'switch 66
- Sub sw66_unHit:Controller.Switch(66)=0:End Sub'switch 66
- Sub sw62_Hit:vpmTimer.PulseSw(62):End Sub 'switch 62
- Sub sw72_Hit:vpmTimer.PulseSw(72):End Sub 'switch 72
- Sub sw31_Hit:vpmTimer.PulseSw(31):End Sub 'switch 31
- Sub sw32_Hit:vpmTimer.PulseSw(32):End Sub 'switch 32
- Sub sw33_Hit:vpmTimer.PulseSw(33):End Sub 'switch 33
- Sub sw41_Spin:vpmTimer.PulseSw(41):End Sub 'switch 41
- Sub sw42_Hit:vpmTimer.PulseSw(42):End Sub 'switch 42
- Sub sw43_Hit:vpmTimer.PulseSw(43):End Sub 'switch 43
- Sub sw30_Spin:vpmTimer.PulseSw(30):End Sub 'switch 30 'switch 57 Tilt
- Sub sw71_hit:vpmTimer.PulseSw(71):End Sub 'switch 71
- Sub Drain_Hit:bsTrough.AddBall Me: End Sub
- Sub Kicker1_Hit:K1.AddBall 0:End Sub
- Sub KickerRight_Hit:bsSaucer.AddBall 0:End Sub
- Sub sw56_Hit:Controller.Switch(56)=1:End Sub'switch 56
- Sub sw56_unHit:Controller.Switch(56)=0:End Sub'switch 56
- Sub Bumper1_Hit:vpmTimer.PulseSw(44):RandomSoundbumper:End Sub 'switch 44
- Sub Bumper2_Hit:vpmTimer.PulseSw(24):RandomSoundbumper:End Sub 'switch 24
- Sub Bumper3_Hit:vpmTimer.PulseSw(34):RandomSoundbumper:End Sub 'switch 34
- ' Plunger1.fire
- Sub sw53_Hit:Controller.Switch(53)=1:End Sub'switch 53
- Sub sw53_unHit:Controller.Switch(53)=0:End Sub'switch 53
- Sub sw63_Hit:Controller.Switch(63)=1:End Sub'switch 63
- Sub sw63_unHit:Controller.Switch(63)=0:End Sub'switch 63
- Sub sw73_Hit:Controller.Switch(73)=1:End Sub'switch 73
- Sub sw73_unHit:Controller.Switch(73)=0:End Sub'switch 73
- Sub sw45_Hit:Controller.Switch(45)=1:End Sub'switch 45
- Sub sw45_unHit:Controller.Switch(45)=0:End Sub'switch 45
- Sub sw76_Hit:Controller.Switch(76)=1:End Sub'switch 76
- Sub sw76_unHit:Controller.Switch(76)=0:End Sub'switch 76
- sub k2(Enabled)
- Kicker2.kick 0,50
- End Sub
- sub k4(Enabled)
- Kicker4.kick 70,20
- End Sub
- Dim BallsInPlay
- '**********************************************************************************************************
- ' Map Lights to Array
- '**********************************************************************************************************
- set Lights(13)=light13
- set lights(12)=light12
- set Lights(2)=light2
- set lights(3)=Light3
- set lights(5)=light5
- set lights(4)=light4
- set lights(6)=light6
- set lights(7)=light7
- set lights(8)=light8
- set lights(9)=light9
- set lights(10)=light10
- set lights(11)=light11
- set lights(1)=light1
- set lights(14)=light14
- set lights(15)=Light15
- set lights(16)=Light16
- set lights(17)=Light17
- set lights(18)=Light18
- set lights(19)=Light19
- set lights(20)=Light20
- set lights(21)=Light21
- set lights(22)=light22
- set lights(23)=light23
- set lights(24)=light24
- set lights(25)=light25
- set lights(26)=light26
- set lights(27)=light27
- set lights(28)=light28
- set lights(29)=light29
- set lights(30)=light30
- set lights(31)=light31
- set lights(32)=light32
- set lights(33)=light33
- set lights(34)=light34
- set lights(35)=light35
- set lights(36)=light36
- set lights(37)=light37
- set lights(38)=light38
- set lights(39)=light39
- set lights(40)=light40
- set lights(41)=light41
- set lights(42)=light42
- set lights(43)=light43
- set lights(44)=light44
- set lights(45)=light45
- set lights(46)=light46
- set lights(47)=light47
- '**********************************************************************************************************
- ' Backglass Light Displays
- '**********************************************************************************************************
- Sub LampTimer_Timer()
- 'light15a.State = light15.State
- 'light28a.state=light28.state
- 'light29a.state=light29.state
- if light13.state =1 Then
- htt1.enabled=1
- ht1.state=2
- ht2.state=2
- ht3.state=2
- ht4.state=2
- ht5.state=2
- ht6.state=2
- ht7.state=2
- ht8.state=2
- ht9.state=2
- ht10.state=2
- ht11.state=2
- ht12.state=2
- ht13.state=2
- ht14.state=2
- ht15.state=2
- ht16.state=2
- ht17.state=2
- ht18.state=2
- ht19.state=2
- ht20.state=2
- Else
- htt1.enabled=0
- htt=0
- ht1.state=0
- ht2.state=0
- ht3.state=0
- ht4.state=0
- ht5.state=0
- ht6.state=0
- ht7.state=0
- ht8.state=0
- ht9.state=0
- ht10.state=0
- ht11.state=0
- ht12.state=0
- ht13.state=0
- ht14.state=0
- ht15.state=0
- ht16.state=0
- ht17.state=0
- ht18.state=0
- ht19.state=0
- ht20.state=0
- htt1.enabled=0
- lightf1.visible=0
- lightf2.visible=0
- lightf3.visible=0
- lightf4.visible=0
- lightf5.visible=0
- lightf6.visible=0
- lightf7.visible=0
- lightf8.visible=0
- lightf9.visible=0
- lightf10.visible=0
- end If
- if light1.state=0 Then
- gion()
- Else
- gioff()
- end If
- L4=light2.State
- 'If L4<>OL4 Then
- If L4=1 Then
- releasein.collidable=1
- releaseout.collidable=0
- Else
- releaseout.collidable=1
- releasein.collidable=0
- End If
- 'End If
- OL4=L4
- If light14.state=1 Then 'STARGATE RAMP
- Ramp7.HeightBottom = 70
- Ramp7.Collidable = False
- Ramp18.visible=1
- Wall14.visible=1
- wall26.visible=1
- Ramp25.visible=0
- Wall21.visible=0
- wall23.visible=0
- Else
- Ramp7.HeightBottom = 0
- Ramp7.Collidable = True
- wall21.visible=1
- Wall23.visible=1
- Ramp25.visible=1
- Ramp18.visible=0
- Wall14.visible=0
- wall26.visible=0
- End If
- end Sub
- dim htt
- htt=0
- sub htt1_timer
- htt=htt+1
- if htt>10 then htt=1
- select Case htt
- case 1: lightf1.visible=1:lightf10.visible=0
- case 2: lightf2.visible=1:lightf1.visible=0
- case 3: lightf3.visible=1:lightf2.visible=0
- case 4: lightf4.visible=1:lightf3.visible=0
- case 5: lightf5.visible=1:lightf4.visible=0
- case 6: lightf6.visible=1:lightf5.visible=0
- case 7: lightf7.visible=1:lightf6.visible=0
- case 8: lightf8.visible=1:lightf7.visible=0
- case 9: lightf9.visible=1:lightf8.visible=0
- case 10: lightf10.visible=1:lightf9.visible=0
- end Select
- end Sub
- Sub DisplayTimer_Timer
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- End Sub
- ' Dip Switches
- ' ==================================================================
- ' Gottlieb Robo-War
- ' originally added by Inkochnito
- ' Updated Switches 8, 31, and 32
- Sub editDips
- Dim vpmDips : Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700,400,"Robo-War - DIP switches"
- .AddFrame 2,4,190,"Maximum Credits",49152,Array("8",0,"10",32768,"15",&H00004000,"20",49152)'dip 15&16
- .AddFrame 2,80,190,"Coin Chute Left and Right Control",&H00002000,Array("Separate",0,"Same",&H00002000)'dip 14
- .AddFrame 2,126,190,"Playfield Special",&H00200000,Array("Special",0,"Extra Ball",&H00200000)'dip 22
- .AddFrame 2,172,190,"Highest Games to Date Control",&H00000020,Array("No Effect",0,"Reset High Games #2-#5 on Power Off",&H00000020)'dip 6
- .AddFrame 2, 218, 190, "Auto-Percentage Control", &H00000080, Array("Disabled (Normal High Score Mode)", 0, "Enabled", &H00000080)'dip 8
- .AddFrame 2, 264, 190, "Alpha Drop Bank Sequence", &H40000000, Array("Also Award ROBOWAR Letter", 0, "Light Extra Ball Only", &H40000000)'dip 31
- .AddFrame 2, 310, 190, "Number of Active ADV X Targets", &H80000000, Array("More", 0, "Less", &H80000000)'dip 32
- .AddFrame 205,4,190,"Highest Game to Date Awards",&H00C00000,Array("None (Not Displayed)",0,"None",&H00800000,"2 Replay",&H00400000,"3 Replay",&H00C00000)'dip 23&24
- .AddFrame 205,80,190,"Balls/Game",&H01000000,Array("5",0,"3",&H01000000)'dip 25
- .AddFrame 205,126,190,"Replay Limit",&H04000000,Array("No Limit",0,"1",&H04000000)'dip 27
- .AddFrame 205,172,190,"Novelty",&H08000000,Array("Normal",0,"Score 500,000 in Place of Extra Ball and Special",&H08000000)'dip 28
- .AddFrame 205,218,190,"Game Mode",&H10000000,Array("Replay",0,"Extra Ball",&H10000000)'dip 29
- .AddFrame 205,264,190,"3rd Coin Chute Credit Control",&H20000000,Array("No Effect",0,"Add 9",&H20000000)'dip 30
- .AddChk 205,316,180,Array("Match",&H02000000)'dip 26
- .AddChk 205,331,190,Array("Attract Mode Sound",&H00000040)'dip 7
- .AddLabel 50,360,300,20,"After hitting OK, press F3 to reset game with new settings."
- .ViewDips
- End With
- End Sub
- Set vpmShowDips = GetRef("editDips")
- Sub Table1_Exit ' in some tables this needs to be Table1_Exit
- Controller.Stop
- End Sub
- '**********************************************************************************************************
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep,LStep
- Sub RightSlingShot_Slingshot
- vpmTimer.PulseSw(33)
- PlaySound SoundFXDOF("right_slingshot",102 , DOFPulse, DOFContactors), 0, 1, 0.05, 0.05
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.TransZ = -20
- RStep = 0
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
- End Select
- RStep = RStep + 1
- End Sub
- Sub leftSlingShot_Slingshot
- vpmTimer.PulseSw(33)
- PlaySound SoundFXDOF("left_slingshot",101 , DOFPulse, DOFContactors), 0, 1, 0.05, 0.05
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.TransZ = -20
- LStep = 0
- leftSlingShot.TimerEnabled = 1
- End Sub
- Sub leftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:leftSlingShot.TimerEnabled = 0:
- End Select
- LStep = LStep + 1
- End Sub
- ' *********************************************************************
- ' Supporting Ball & Sound Functions
- ' *********************************************************************
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 2000)
- End Function
- Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = ball.x * 2 / table1.width-1
- If tmp > 0 Then
- Pan = Csng(tmp ^10)
- Else
- Pan = Csng(-((- tmp) ^10) )
- End If
- 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) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
- 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, Pan(ball1), 0, Pitch(ball1), 0, 0
- 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, PAN and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the PAN function 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 rollingmetal_Hit (idx)
- PlaySound "Wire Ramp", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- 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), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Select
- End Sub
- Sub RandomSoundbumper()
- Select Case Int(Rnd*5)+1
- Case 1 : PlaySound SoundFX("fx_Bumper",DOFContactors)
- Case 2 : PlaySound SoundFX("fx_Bumper1",DOFContactors)
- Case 3 : PlaySound SoundFX("fx_Bumper2",DOFContactors)
- Case 4 : PlaySound SoundFX("fx_bumper3",DOFContactors)
- Case 5 : PlaySound SoundFX("fx_bumper4",DOFContactors)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub LeftFlipper1_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper1_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment