Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.65 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Const cGameName = "evelknie",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin"
  10.  
  11. LoadVPM"01000100","BALLY.VBS",1.2
  12. Dim DesktopMode: DesktopMode = Table1.ShowDT
  13.  
  14. If DesktopMode = True Then 'Show Desktop components
  15. Ramp16.visible=1
  16. Ramp15.visible=1
  17. Primitive13.visible=1
  18. Else
  19. Ramp16.visible=0
  20. Ramp15.visible=0
  21. Primitive13.visible=0
  22. End if
  23.  
  24. '*************************************************************
  25.  
  26. 'Solenoid Call backs
  27. '**********************************************************************************************************
  28. SolCallback(2) = "vpmSolSound SoundFX(""Bell10"",DOFChimes),"
  29. SolCallback(3) = "vpmSolSound SoundFX(""Bell100"",DOFChimes),"
  30. SolCallback(4) = "vpmSolSound SoundFX(""Bell1000"",DOFChimes),"
  31. SolCallback(5) = "vpmSolSound SoundFX(""Bell10000"",DOFChimes),"
  32. SolCallback(6) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  33. SolCallback(7) = "bsTrough.SolOut"
  34. SolCallback(8) = "bsSaucer.SolOut"
  35. SolCallback(13) = "dtR.SolDropUp"
  36. SolCallback(19) = "vpmNudge.SolGameOn"
  37.  
  38. SolCallback(sLRFlipper) = "SolRFlipper"
  39. SolCallback(sLLFlipper) = "SolLFlipper"
  40.  
  41. Sub SolLFlipper(Enabled)
  42. If Enabled Then
  43. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd
  44. Else
  45. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart
  46. End If
  47. End Sub
  48.  
  49. Sub SolRFlipper(Enabled)
  50. If Enabled Then
  51. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  52. Else
  53. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  54. End If
  55. End Sub
  56. '**********************************************************************************************************
  57.  
  58. 'Solenoid Controlled toys
  59. '**********************************************************************************************************
  60.  
  61. '*****GI Lights On
  62. dim xx
  63. For each xx in GI:xx.State = 1: Next
  64.  
  65. '**********************************************************************************************************
  66.  
  67. 'Initiate Table
  68. '**********************************************************************************************************
  69.  
  70. Dim bsTrough, bsSaucer, dtR
  71.  
  72. Sub Table1_Init
  73. vpmInit Me
  74. On Error Resume Next
  75. With Controller
  76. .GameName = cGameName
  77. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  78. .SplashInfoLine = "Evel Knievel Bally"&chr(13)&"You Suck"
  79. .HandleMechanics=0
  80. .HandleKeyboard=0
  81. .ShowDMDOnly=1
  82. .ShowFrame=0
  83. .ShowTitle=0
  84. .hidden = 1
  85. On Error Resume Next
  86. .Run GetPlayerHWnd
  87. If Err Then MsgBox Err.Description
  88. On Error Goto 0
  89. End With
  90. On Error Goto 0
  91.  
  92. PinMAMETimer.Interval=PinMAMEInterval
  93. PinMAMETimer.Enabled=1
  94.  
  95. vpmNudge.TiltSwitch = 7
  96. vpmNudge.Sensitivity = 1
  97. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, Bumper4, Bumper5, LeftSlingshot, RightSlingshot)
  98.  
  99. Set bsTrough=New cvpmBallStack
  100. bsTrough.InitNoTrough BallRelease,8,70,8
  101. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  102.  
  103. Set bsSaucer=New cvpmBallStack
  104. bsSaucer.InitSaucer SW29,29,180,8
  105. bsSaucer.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  106. bsSaucer.KickAngleVar=10
  107.  
  108. Set dtR=New cvpmDropTarget
  109. dtR.InitDrop Array(SW1,SW2,SW3,SW4,SW5),Array(1,2,3,4,5)
  110. dtR.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  111.  
  112. End Sub
  113.  
  114. '**********************************************************************************************************
  115. 'Plunger code
  116. '**********************************************************************************************************
  117. Sub Table1_KeyDown(ByVal keycode)
  118. If vpmKeyDown(KeyCode) Then Exit Sub
  119. If keycode=PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  120. End Sub
  121.  
  122. Sub Table1_KeyUp(ByVal keycode)
  123. If vpmKeyUp(KeyCode) Then Exit Sub
  124. If keycode=PlungerKey Then Plunger.Fire:playsound"plunger"
  125. End Sub
  126. '**********************************************************************************************************
  127.  
  128. ' Switches
  129. '**********************************************************************************************************
  130.  
  131. ' Drain hole and kickers
  132. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  133. Sub SW29_Hit:bsSaucer.AddBall 0 : playsound "popper_ball": End Sub
  134.  
  135. ' Droptargets
  136. Sub SW1_Dropped:dtR.Hit 1:End Sub
  137. Sub SW2_Dropped:dtR.Hit 2:End Sub
  138. Sub SW3_Dropped:dtR.Hit 3:End Sub
  139. Sub SW4_Dropped:dtR.Hit 4:End Sub
  140. Sub SW5_Dropped:dtR.Hit 5:End Sub
  141.  
  142. 'Bumpers
  143. Sub Bumper1_Hit : vpmTimer.PulseSw(40) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  144. Sub Bumper2_Hit : vpmTimer.PulseSw(39) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  145. Sub Bumper3_Hit : vpmTimer.PulseSw(38) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  146. Sub Bumper4_Hit : vpmTimer.PulseSw(25) : DOF 101, DOFPulse : End Sub
  147. Sub Bumper5_Hit : vpmTimer.PulseSw(25) : DOF 102, DOFPulse : End Sub
  148.  
  149. ' Rollovers
  150. Sub SW20_Hit:Controller.Switch(20)=1 : playsound"rollover" : End Sub
  151. Sub SW20_unHit:Controller.Switch(20)=0:End Sub
  152. Sub SW21_Hit:Controller.Switch(21)=1 : playsound"rollover" : End Sub
  153. Sub SW21_unHit:Controller.Switch(21)=0:End Sub
  154. Sub SW23_Hit:Controller.Switch(23)=1 : playsound"rollover" : End Sub
  155. Sub SW23_unHit:Controller.Switch(23)=0:End Sub
  156. Sub SW24_Hit:Controller.Switch(24)=1 : playsound"rollover" : End Sub
  157. Sub SW24_unHit:Controller.Switch(24)=0:End Sub
  158. Sub SW32A_Hit:Controller.Switch(32)=1 : playsound"rollover" : DOF 105, DOFOn : End Sub
  159. Sub SW32A_unHit:Controller.Switch(32)=0: DOF 105, DOFOff : End Sub
  160. Sub SW32B_Hit:Controller.Switch(32)=1 : playsound"rollover" : DOF 106, DOFOn : End Sub
  161. Sub SW32B_unHit:Controller.Switch(32)=0: DOF 106, DOFOff : End Sub
  162.  
  163. ' Stand Up Targets
  164. Sub SW17_Hit:vpmTimer.PulseSw 17:End Sub
  165. Sub SW18_Hit:vpmTimer.PulseSw 18:End Sub
  166. Sub SW19_Hit:vpmTimer.PulseSw 19:End Sub
  167. Sub SW22_Hit:vpmTimer.PulseSw 22:End Sub
  168. Sub SW26A_Hit:vpmTimer.PulseSw 26:DOF 103, DOFPulse:End Sub
  169. Sub SW26B_Hit:vpmTimer.PulseSw 26:DOF 104, DOFPulse:End Sub
  170.  
  171. 'Spinners
  172. Sub sw30_Spin:vpmTimer.PulseSw 30 : playsound"fx_spinner" : End Sub
  173. Sub sw31_Spin:vpmTimer.PulseSw 31 : playsound"fx_spinner" : End Sub
  174.  
  175. '**********************************************************************************************************
  176. 'Map lights to an array
  177. '**********************************************************************************************************
  178.  
  179. Set Lights(1)=l1
  180. Set Lights(2)=l2
  181. Set Lights(3)=l3
  182. Lights(4)=array(l4,l4a)
  183. Lights(5)=array(l5,L5A)
  184. Set Lights(7)=l7
  185. Set Lights(8)=l8
  186. Set Lights(9)=l9
  187. Set Lights(10)=l10
  188. Set Lights(17)=l17
  189. Set Lights(18)=l18
  190. Set Lights(19)=l19
  191. Lights(20)=array(l20,L20A)
  192. Set Lights(22)=l22
  193. Set Lights(23)=l23
  194. Set Lights(25)=l25
  195. Set Lights(26)=l26
  196. Set Lights(33)=l33
  197. Set Lights(34)=l34
  198. Lights(36)=array(l36,L36a)
  199. Set Lights(37)=l37 'Bumper 3 Light
  200. Set Lights(38)=l38
  201. Set Lights(39)=l39
  202. Set Lights(40)=l40
  203. Set Lights(41)=l41
  204. Set Lights(42)=l42
  205. Set Lights(43)=l43
  206. Set Lights(49)=l49
  207. Set Lights(50)=l50
  208. Set Lights(51)=l51
  209. Lights(52)=array(l52,L52A)
  210. Lights(53)=array(l53,L53a) 'Bumper 1 and Bumper 2 Light
  211. Set Lights(54)=l54
  212. Set Lights(55)=l55
  213. Set Lights(56)=l56
  214. Set Lights(57)=l57
  215. Set Lights(59)=l59
  216.  
  217. 'backglass
  218. 'Set Lights(11)=Light11 'Extra Ball
  219. 'Set Lights(15)=Light15 'Player 1
  220. 'Set Lights(31)=Light31 'Player 2
  221. 'Set Lights(47)=Light47 'Player 3
  222. 'Set Lights(63)=Light63 'Player 4
  223. 'Set Lights(13)=Light13 'Ball in Play
  224. 'Set Lights(27)=Light27 'Match
  225. 'Set Lights(29)=Light29 'High Score
  226. 'Set Lights(43)=Light43 'Same Player Shoot Again
  227. 'Set Lights(45)=Light45 'game over
  228. 'Set Lights(61)=Light61 'tilt
  229.  
  230.  
  231. '**********************************************************************************************************
  232. ' Backglass Light Displays (7 digit 7 segment displays)
  233. Dim Digits(28)
  234.  
  235. ' 1st Player
  236. Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
  237. Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
  238. Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
  239. Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
  240. Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
  241. Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
  242.  
  243.  
  244. ' 2nd Player
  245. Digits(6) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
  246. Digits(7) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
  247. Digits(8) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
  248. Digits(9) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
  249. Digits(10) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
  250. Digits(11) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
  251.  
  252.  
  253. ' 3rd Player
  254. Digits(12) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  255. Digits(13) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  256. Digits(14) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  257. Digits(15) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  258. Digits(16) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  259. Digits(17) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  260.  
  261.  
  262. ' 4th Player
  263. Digits(18) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  264. Digits(19) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  265. Digits(20) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  266. Digits(21) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  267. Digits(22) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  268. Digits(23) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  269.  
  270.  
  271. ' Credits
  272. Digits(24) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
  273. Digits(25) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
  274. ' Balls
  275. Digits(26) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
  276. Digits(27) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
  277.  
  278. Sub DisplayTimer_Timer
  279. Dim ChgLED,ii,num,chg,stat,obj
  280. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  281. If Not IsEmpty(ChgLED) Then
  282. If DesktopMode = True Then
  283. For ii = 0 To UBound(chgLED)
  284. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  285. if (num < 28) then
  286. For Each obj In Digits(num)
  287. If chg And 1 Then obj.State = stat And 1
  288. chg = chg\2 : stat = stat\2
  289. Next
  290. else
  291. if char(stat) > "" then msg(num) = char(stat)
  292. end if
  293. next
  294. end if
  295. end if
  296. End Sub
  297.  
  298. '**********************************************************************************************************
  299. '**********************************************************************************************************
  300.  
  301. 'Bally Evel Knievel
  302. 'added by Inkochnito
  303. Sub editDips
  304. Dim vpmDips:Set vpmDips=New cvpmDips
  305. With vpmDips
  306. .AddForm 700,400,"Evel Knievel - DIP switches"
  307. .AddFrame 2,2,190,"Maximum credits",&H00070000,Array("5 credits",0,"10 credits",&H00010000,"15 credits",&H00020000,"20 credits",&H00030000,"25 credits",&H00040000,"30 credits",&H00050000,"35 credits",&H00060000,"40 credits",&H00070000)'dip 17&18&19
  308. .AddFrame 2,134,190,"High game to date award",&H00006000,Array("no award",0,"1 credit",&H00002000,"2 credits",&H00004000,"3 credits",&H00006000)'dip 14&15
  309. .AddFrame 2,211,190,"High score feature",&H00000020,Array("extra ball",0,"replay",&H00000020)'dip 6
  310. .AddFrame 2,258,190,"Balls per game", 32768,Array("3 balls",0,"5 balls", 32768)'dip 16
  311. .AddFrame 2,306,190,"CYCLE outlane special",&H00800000,Array("alternating from side to side",0,"both outlanes lit",&H00800000)'dip 24
  312. .AddFrame 205,2,190,"Completing SUPER award",&H03000000,Array("no award",0,"extra ball",&H01000000,"1 replay",&H02000000,"2 replays",&H03000000)'dip 25&26
  313. .AddFrame 205,78,190,"Outlane special award",&HC0000000,Array("no award",0,"extra ball",&H40000000,"replay",&H80000000,"replay and extra ball",&HC0000000)'dip 31&32
  314. .AddFrame 205,154,190,"Drop targets 2nd time down",&H0C000000,Array("no award",0,"5,000 points",&H04000000,"5,000 points, extra ball",&H08000000,"extra ball",&H0C000000)'dip 27&28
  315. .AddFrame 205,230,190,"Drop targets 3rd time down",&H30000000,Array("no award",0,"5,000 points",&H10000000,"extra ball",&H20000000,"replay",&H30000000)'dip 29&30
  316. .AddChk 205,310,120,Array("Match feature",&H00100000)'dip 21
  317. .AddChk 205,325,120,Array("Credits display",&H00080000)'dip 20
  318. .AddChk 205,340,120,Array("Melody option",&H00000080)'dip 8
  319. .AddLabel 50,370,300,20,"After hitting OK, press F3 to reset game with new settings."
  320. .ViewDips
  321. End With
  322. End Sub
  323. Set vpmShowDips=GetRef("editDips")
  324.  
  325. '**********************************************************************************************************
  326. '**********************************************************************************************************
  327.  
  328. '**********************************************************************************************************
  329. '**********************************************************************************************************
  330.  
  331.  
  332. '**********Sling Shot Animations
  333. ' Rstep and Lstep are the variables that increment the animation
  334. '****************
  335. Dim RStep, Lstep
  336.  
  337. Sub RightSlingShot_Slingshot
  338. vpmTimer.PulseSw 36
  339. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  340. RSling.Visible = 0
  341. RSling1.Visible = 1
  342. sling1.TransZ = -20
  343. RStep = 0
  344. RightSlingShot.TimerEnabled = 1
  345. End Sub
  346.  
  347. Sub RightSlingShot_Timer
  348. Select Case RStep
  349. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  350. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  351. End Select
  352. RStep = RStep + 1
  353. End Sub
  354.  
  355. Sub LeftSlingShot_Slingshot
  356. vpmTimer.PulseSw 37
  357. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  358. LSling.Visible = 0
  359. LSling1.Visible = 1
  360. sling2.TransZ = -20
  361. LStep = 0
  362. LeftSlingShot.TimerEnabled = 1
  363. End Sub
  364.  
  365. Sub LeftSlingShot_Timer
  366. Select Case LStep
  367. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  368. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  369. End Select
  370. LStep = LStep + 1
  371. End Sub
  372.  
  373.  
  374.  
  375. ' *********************************************************************
  376. ' Supporting Ball & Sound Functions
  377. ' *********************************************************************
  378.  
  379. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  380. Vol = Csng(BallVel(ball) ^2 / 2000)
  381. End Function
  382.  
  383. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  384. Dim tmp
  385. tmp = ball.x * 2 / table1.width-1
  386. If tmp > 0 Then
  387. Pan = Csng(tmp ^10)
  388. Else
  389. Pan = Csng(-((- tmp) ^10) )
  390. End If
  391. End Function
  392.  
  393. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  394. Pitch = BallVel(ball) * 20
  395. End Function
  396.  
  397. Function BallVel(ball) 'Calculates the ball speed
  398. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  399. End Function
  400.  
  401. '*****************************************
  402. ' JP's VP10 Rolling Sounds
  403. '*****************************************
  404.  
  405. Const tnob = 5 ' total number of balls
  406. ReDim rolling(tnob)
  407. InitRolling
  408.  
  409. Sub InitRolling
  410. Dim i
  411. For i = 0 to tnob
  412. rolling(i) = False
  413. Next
  414. End Sub
  415.  
  416. Sub RollingTimer_Timer()
  417. Dim BOT, b
  418. BOT = GetBalls
  419.  
  420. ' stop the sound of deleted balls
  421. For b = UBound(BOT) + 1 to tnob
  422. rolling(b) = False
  423. StopSound("fx_ballrolling" & b)
  424. Next
  425.  
  426. ' exit the sub if no balls on the table
  427. If UBound(BOT) = -1 Then Exit Sub
  428.  
  429. ' play the rolling sound for each ball
  430. For b = 0 to UBound(BOT)
  431. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  432. rolling(b) = True
  433. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  434. Else
  435. If rolling(b) = True Then
  436. StopSound("fx_ballrolling" & b)
  437. rolling(b) = False
  438. End If
  439. End If
  440. Next
  441. End Sub
  442.  
  443. '**********************
  444. ' Ball Collision Sound
  445. '**********************
  446.  
  447. Sub OnBallBallCollision(ball1, ball2, velocity)
  448. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  449. End Sub
  450.  
  451. '*****************************************
  452. ' FLIPPER SHADOWS
  453. '*****************************************
  454.  
  455. sub FlipperTimer_Timer()
  456. FlipperLSh.RotZ = LeftFlipper.currentangle
  457. FlipperRSh.RotZ = RightFlipper.currentangle
  458.  
  459. End Sub
  460.  
  461. '*****************************************
  462. ' BALL SHADOW
  463. '*****************************************
  464. Dim BallShadow
  465. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  466.  
  467. Sub BallShadowUpdate_timer()
  468. Dim BOT, b
  469. BOT = GetBalls
  470. ' hide shadow of deleted balls
  471. If UBound(BOT)<(tnob-1) Then
  472. For b = (UBound(BOT) + 1) to (tnob-1)
  473. BallShadow(b).visible = 0
  474. Next
  475. End If
  476. ' exit the Sub if no balls on the table
  477. If UBound(BOT) = -1 Then Exit Sub
  478. ' render the shadow for each ball
  479. For b = 0 to UBound(BOT)
  480. If BOT(b).X < Table1.Width/2 Then
  481. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 13
  482. Else
  483. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 13
  484. End If
  485. ballShadow(b).Y = BOT(b).Y + 10
  486. If BOT(b).Z > 20 Then
  487. BallShadow(b).visible = 1
  488. Else
  489. BallShadow(b).visible = 0
  490. End If
  491. Next
  492. End Sub
  493.  
  494.  
  495.  
  496. '************************************
  497. ' What you need to add to your table
  498. '************************************
  499.  
  500. ' a timer called RollingTimer. With a fast interval, like 10
  501. ' one collision sound, in this script is called fx_collide
  502. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  503. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  504.  
  505.  
  506. '******************************************
  507. ' Explanation of the rolling sound routine
  508. '******************************************
  509.  
  510. ' sounds are played based on the ball speed and position
  511.  
  512. ' the routine checks first for deleted balls and stops the rolling sound.
  513.  
  514. ' The For loop goes through all the balls on the table and checks for the ball speed and
  515. ' if the ball is on the table (height lower than 30) then then it plays the sound
  516. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  517.  
  518. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  519. ' will change according to the ball speed, and the PAN function will change the stereo position according
  520. ' to the position of the ball on the table.
  521.  
  522.  
  523. '**************************************
  524. ' Explanation of the collision routine
  525. '**************************************
  526.  
  527. ' The collision is built in VP.
  528. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  529. ' 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
  530. ' depending of the speed of the collision.
  531.  
  532.  
  533. Sub Pins_Hit (idx)
  534. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  535. End Sub
  536.  
  537. Sub Targets_Hit (idx)
  538. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  539. End Sub
  540.  
  541. Sub Metals_Thin_Hit (idx)
  542. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  543. End Sub
  544.  
  545. Sub Metals_Medium_Hit (idx)
  546. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  547. End Sub
  548.  
  549. Sub Metals2_Hit (idx)
  550. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  551. End Sub
  552.  
  553. Sub Gates_Hit (idx)
  554. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  555. End Sub
  556.  
  557. Sub Spinner_Spin
  558. PlaySound "fx_spinner",0,.25,0,0.25
  559. End Sub
  560.  
  561. Sub Rubbers_Hit(idx)
  562. dim finalspeed
  563. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  564. If finalspeed > 20 then
  565. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  566. End if
  567. If finalspeed >= 6 AND finalspeed <= 20 then
  568. RandomSoundRubber()
  569. End If
  570. End Sub
  571.  
  572. Sub Posts_Hit(idx)
  573. dim finalspeed
  574. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  575. If finalspeed > 16 then
  576. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  577. End if
  578. If finalspeed >= 6 AND finalspeed <= 16 then
  579. RandomSoundRubber()
  580. End If
  581. End Sub
  582.  
  583. Sub RandomSoundRubber()
  584. Select Case Int(Rnd*3)+1
  585. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  586. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  587. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  588. End Select
  589. End Sub
  590.  
  591. Sub LeftFlipper_Collide(parm)
  592. RandomSoundFlipper()
  593. End Sub
  594.  
  595. Sub RightFlipper_Collide(parm)
  596. RandomSoundFlipper()
  597. End Sub
  598.  
  599. Sub RandomSoundFlipper()
  600. Select Case Int(Rnd*3)+1
  601. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  602. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  603. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  604. End Select
  605. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement