Jump to content



Submitter

SUPPORT TOPIC File Information

  • Submitted: Jul 26 2023 12:11 AM
  • Last Updated: Jul 26 2023 12:15 AM
  • File Size: 50.89MB
  • Views: 5072
  • Downloads: 1,132
  • Author(s): JINO0372
  • Manufacturer: Williams
  • Year: 1961
  • IPDB Link:
  • Permission to MOD?: Yes, with approval

Download Double Barrel (Williams 1961) 1.0

* * * * * 30 Votes



Screenshots
Double Barrel (Williams 1961)
 
The zip file contains the VPX7 (10.7.3) table, directb2s, flyer, and a wheel image.  The wheel image is not “tarcisio” style.  I am not a fan of these type of wheel images.  My plan was to release this and any new releases as VPX8, but I still need more time learning everything new in VPX8.  Like my previous tables I started from scratch.  The resources were not very good on this table, and I did the best I could with what I could find.  A lifesaver for this build was a YouTube video demonstrating the game play.  The game is a two-player.  Key features are the moving target, two skill (aka gobble) holes, and two kickers at the bottom that launch the ball at the moving target.
 
Feature you can change via the script are:
  • 3 or 5 Balls (Default is 5)
  • Manual or Auto Ball Lifter (Default is Auto)
  • Drain Post On or Off (Default is On)
You can also change the LUT value before starting the game with the right magnasave key.
 
The drain post I added as I found pics of one table with it and some tables without it.  Based on the image in the flyer I believe it was not included in the production model and was added later by the machine’s owner.  I gave you the option to turn it off or leave it on.  I would like to thank the following individuals.  With out them I would not have been able to make this table or provide some of the fun features.
 
LOSERMAN76 – Moving target primitives and script.
JPSALAS – Rolling ball sounds script. LUT selection script.  VPX7 material physics.
JLOULOULOU – Flipper tricks script.
ROTHBAUERW – Manual ball control script.  Ball dropping sounds script.
NINUZZU – Ball shadows script. Flipper shadows script.
 
A special thank you to William Brown (YouTuber) - His YouTube demonstration video was an invaluable resource. From the video I learned the gameplay, scoring, lights, and sounds.
 

 
I also want to thank everyone on the VPX dev team and the entire VP community!!!
 

What's New in Version 1.0 (See full changelog)

  • Initial Release


Screenshots

Screenshots


Awesome love these old tables!

Love these older tables - especially when they have a more unique feature like the cannons at the bottom. Thanks for sharing this!

This is a great table! 

 

If anyone wants DOF, one way to do it is to replace the current script with:

'*****************************************************************************************************
'*			Williams Double Barrel (1961)															 *
'*			VPX Table Primary Build/Script by JINO0372 (see additional thanks)       				 *
'* 			Artwork by JINO0372																		 *
'*			Backglass & dB2S by JINO0372															 *
'*																									 *																								 
'*																									 *
'*			++Special thanks to ++																	 *
'*																									 *
'*			William Brown - His YouTube demostration video was an invaluable resource. From 		 *
'*          the video I learned the gameplay, scoring, lights, and sounds.   						 *
'*			Link to video: https://www.youtube.com/watch?v=2GtnBVx527g   							 *
'*																									 *
'*          ++Additional thanks to the following++											 		 *
'*			 		 																				 *
'*			LOSERMAN76 - Moving target primtives and script.										 *
'*			JPSALAS - Rolling sounds, LUT selection, and Material Physics Script					 *	
'*			JLOULOULOU - Flipper Tricks	Script														 *
'*			ROTHBAUERW -  Manual Ball Control and Ball Dropping Sound Script						 *
'*			NINUZZU - Flipper and Ball Shadows Script        										 *
'*																									 *
'*			++Also thanks to everyone in the VP community!!!++										 *
'*																									 *
'*																									 *
'*****************************************************************************************************


Option Explicit
Randomize


On Error Resume Next
ExecuteGlobal GetTextFile("core.vbs")
If Err Then MsgBox "You need the core.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
On Error Goto 0

On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
On Error Goto 0

Const cGameName = "cyberrace_doublebarrel"
Const B2STableName="doublebarrel"

Dim LifterOption
Dim EnableRetractPlunger
Dim EnableBallControl
Dim Credits
Dim Players
Dim PlayerUp
Dim Score(2)
Dim B2SOn
Dim lstep
Dim rstep
Dim Tilt
Dim TiltSensor
Dim BallstoPlay
Dim BallstoPlay2
Dim GameinProgress
Dim GameStart
Dim HighScore
Dim BallinLane
Dim PlayedBalls
Dim BallsperGame
Dim aXpos
Dim aXadd
Dim aYpos
Dim aYadd
Dim aZpos
Dim aBall
Dim Replay
Dim GotReplay
Dim gBall
Dim x
Dim BonusCount
Dim BIP
Dim Matchnumber
Dim BC1(2)
Dim BC2(2)
Dim BC3(2)
Dim BC4(2)
Dim CollectioninProcess
Dim CollectioninProcess1
Dim movetarget
Dim movedirection
Dim movetargetup
Dim movetargetupcount
Dim GobbleBonus
Dim LeftSide
Dim RightSide
Dim DrainPost


'*****User Configurable Options

LifterOption=2 '1 = manual lifter...2 = auto lifter
BallsPerGame=5 'Set to either 3 or 5
DrainPost=True 'False = No Drain Post...True = Include Drain Post
EnableRetractPlunger = false 'Change to true to enable retracting the plunger at a linear speed; wait for 1 second at the maximum position; move back towards the resting position; nice for button/key plungers
EnableBallControl = false 'Change to true to enable manual ball control (or press C in-game) via the arrow keys and B (boost movement) keys

'*****End of User Configurable Options


Dim DesktopMode: DesktopMode = DoubleBarrel.ShowDT

If DesktopMode = True then
	For Each X in DT
		X.Visible=True
		Next
	Else
	For Each X in DT
		X.Visible=False
		Next
End If

If BallsPerGame=5 Then 
	Apron_5.visible=True
	Apron_3.visible=False
Else
	Apron_5.visible=False
	Apron_3.visible=True
End If

If DrainPost = False Then
	Peg049.Visible=False
	Peg049.Collidable=False
	Rubber025.Visible=False
	Rubber025.Collidable=False
	LowScrew002.Visible=False
Else
	Peg049.Visible=True
	Peg049.Collidable=True
	Rubber025.Visible=True
	Rubber025.Collidable=True
	LowScrew002.Visible=True
End If

Sub DoubleBarrel_Init()
	LoadEM
	loadhs
	loadcreds
	LoadLUT 'JP's LUT Control 
	UpdatePostIt
	ballinlane=1
	Tilt=0
	TiltLight.SetValue 0
	TiltLight2.SetValue 0
	GameOver.SetValue 1
	GameOverL.State=1 'Gameover DT On
	GameOverL2.State=1 'Gameover DT On
	If B2SOn then 
		Controller.B2SSetGameOver 35,1 'Gameover On
		Controller.B2SSetScorePlayer 1, Score(0) 'Player 1 Score
		Controller.B2SSetScorePlayer 2, Score(1) 'Player 2 Score
		Controller.B2SSetdata 40,0 'Player 1 Up
		Controller.B2SSetdata 41,0 'Player 2 Up
		Controller.B2SSetdata 42,0 'CanPlay1
		Controller.B2SSetdata 43,0 'CanPlay2
		Controller.B2SSetdata 44,0 'Tilt1
		Controller.B2SSetdata 45,0 'Tilt2
		Controller.B2SSetdata 50,0 'BIP1
		Controller.B2SSetdata 51,0 'BIP2
		Controller.B2SSetdata 52,0 'BIP3
		Controller.B2SSetdata 53,0 'BIP4
		Controller.B2SSetdata 54,0 'BIP5
		Controller.B2SSetdata 55,0 'Snippet
		Controller.B2SSetmatch 34,0 'Match Off
	End If
	Replay=0
	TiltSensor=0
	GameinProgress=0
	GameStart=0
	Score(0)=0
	Score(1)=0
	BallstoPlay=0
	BallstoPlay2=0
	ScoreText.Text="0"
	ScoreText2.Text="0"
	BallsText.text = "0"
	BallsText2.text = "0"
	EMReel001.setvalue(0)
	EMReel002.setvalue(0)
	gball=0
	BonusCount=0
	GobbleBonus=0
	Players=0
	BIP=0
	Player1UpLight.State=0
	Player2UpLight.State=0
	can1Play.State=0
	can2Play.State=0
	Matchnumber=1
	MatchText.text=" "
	MatchText2.text=" "
	BC1(0)=False
	BC1(1)=False
	BC2(0)=False
	BC2(1)=False
	BC3(0)=False
	BC3(1)=False
	BC4(0)=False
	BC4(1)=False
	CollectioninProcess=0
	CollectioninProcess1=0
	LeftSide=1
	RightSide=0
	LeftTriggerLight.State=0
	RightTriggerLight.State=0
	BumperOffLight.State=0

	For Each X in MatchDT
		X.visible=0
		Next

	dim xx
	For each xx in GI:xx.State = 0: Next 'GI Lights Off

	Dim i
	For each i in Collection2:i.Visible=0: Next
	

	If Credits > 0 Then
		Credittext.Text=Credits
		CreditsReel.SetValue(Credits)
		If B2SOn Then Controller.B2SSetCredits Credits
		DOF 119, DOFOn
		Else
		Credittext.Text= "0"
		DOF 119, DOFOff
	end If

End Sub

Sub EndofGame()
	PlaySound "Motorleer"
	credittext.text=credits
	CreditsReel.SetValue(Credits)
	If B2SOn Then 
		Controller.B2SSetCredits Credits
		Controller.B2SSetGameOver 35,1 'Gameover On
		Controller.B2SSetdata 40,0 'Player 1 Up
		Controller.B2SSetdata 41,0 'Player 2 Up
		Controller.B2SSetdata 42,0 'CanPlay1
		Controller.B2SSetdata 43,0 'CanPlay2
		Controller.B2SSetdata 50,0 'BIP1
		Controller.B2SSetdata 51,0 'BIP2
		Controller.B2SSetdata 52,0 'BIP3
		Controller.B2SSetdata 53,0 'BIP4
		Controller.B2SSetdata 54,0 'BIP5
		Controller.B2SSetdata 55,0 'Snippet
	End If
	BallsText.Text=BallstoPlay
	BallsText2.Text=BallstoPlay2
	BIP=0
	Players=0
    can1Play.State=0
    can2Play.State=0
	Player1UpLight.State=0
	Player2UpLight.State=0
	GameinProgress=0
    StopSound "buzz"
    StopSound "buzzl"
	GameOver.SetValue 1
	GameOverL.State=1 'Gameover DT On
	GameOverL2.State=1 'Gameover DT On
	If BallsperGame=5 Then BIPLight005.SetValue 0 Else BIPLight003.SetValue 0
	Match()

	dim xx
	For each xx in GI:xx.State = 0: Next 'GI Lights Off

	For each xx in PFLights:xx.State = 0: Next 'Playfield Lights Off

	MovingTargetTimer.enabled=False

	PBumperLight001.State=0
	PBumperLight002.State=0
	PBumperLight003.State=0

	Bumper1Light.State=0
	Bumper2Light.State=0

	LeftTriggerLight.State=0
	RightTriggerLight.State=0
	BumperOffLight.State=0

    SolLFlipper 0
    SolRFlipper 0

End Sub

Sub DoubleBarrel_KeyDown(ByVal keycode)
	If keycode = PlungerKey Then
        If EnableRetractPlunger Then
            Plunger.PullBackandRetract
        Else
		    Plunger.PullBack
        End If
		PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
	End If

	If HSEnterMode Then HighScoreProcessKey(keycode)

	If keycode=LeftFlipperKey Then
		If Tilt=0 Then
			If GameinProgress=1 Then
				LeftFlipper.TimerEnabled = True 'This line is only for ninuzzu's flipper shadows!
				SolLFlipper 1
			End If
		End If
	End If

	If keycode=RightFlipperKey Then
		If Tilt=0 Then
			If GameinProgress=1 Then
				RightFlipper.TimerEnabled = True 'This line is only for ninuzzu's flipper shadows!
				SolRFlipper 1
			End If
		End If
	End If

	If keycode = LeftTiltKey Then
		Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
		TiltSensor=TiltSensor+25
	End If

	If keycode = RightTiltKey Then
		Nudge 270, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
		TiltSensor=TiltSensor+25
	End If

	If keycode = CenterTiltKey Then
		Nudge 0, 9:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
		TiltSensor=TiltSensor+25
	End If

	If GameinProgress=0 Then ' JP's LUT Control
		If keycode = LeftMagnaSave Then bLutActive = True: Lutbox.text = "level of darkness " & LUTImage + 1 
		If keycode = RightMagnaSave AND bLutActive Then NextLUT:End If 
	End If

	If LifterOption=1 and keycode = RightMagnasave and (BallstoPlay>0 or BallstoPlay2>0) and BallinLane=0 then
		playsound SoundFXDOF ("DBBallup", 115, DOFPulse, DOFContactors)
		BallLifter2.Enabled=True
	End If '1 = manual lifter...2 = auto lifter

'***** Manual Ball Control
	If keycode = 46 Then	 				' C Key
		If EnableBallControl = 1 Then
			EnableBallControl = 0
		Else
			EnableBallControl = 1
		End If
	End If
    If EnableBallControl = 1 Then
		If keycode = 48 Then 				' B Key
			If BCboost = 1 Then
				BCboost = BCboostmulti
			Else
				BCboost = 1
			End If
		End If
		If keycode = 203 Then BCleft = 1	' Left Arrow
		If keycode = 200 Then BCup = 1		' Up Arrow
		If keycode = 208 Then BCdown = 1	' Down Arrow
		If keycode = 205 Then BCright = 1	' Right Arrow
	End If

	If Keycode = StartGameKey And Not HSEnterMode=true then
		If GameinProgress=0 and credits>0 and Players=0 and Players<2 then
			ballinlane=0
			playedballs=0
			Credits=Credits-1
			Players=Players+1
			If Credits < 1 Then DOF 119, DOFOff
			CreditText.text=Credits
			CreditsReel.SetValue(Credits)
			If B2SOn Then 
				Controller.B2SSetCredits Credits
				Controller.B2SSetdata 42,1 'CanPlay1
			End If
			GameStart=1
			PlaySound "DBStartup"
			BallstoPlay=BallsPerGame
			BallsText.Text=BallstoPlay
			BIP=1
			can1Play.State=1
			GameinProgress=1
			GameOver.SetValue 0
			GameOverL.State=0 'Gameover DT Off
			GameOverL2.State=0 'Gameover DT Off
			Start_Game()
		ElseIf GameinProgress=1 and Credits>0 and Players>0 and Players<2 and Score(0) = 0 Then
			Credits=Credits-1
			Players=Players+1
			If Credits < 1 Then DOF 119, DOFOff
			CreditText.text=Credits
			CreditsReel.SetValue(Credits)
			If B2SOn Then 
				Controller.B2SSetCredits Credits
				Controller.B2SSetdata 43,1 'CanPlay2
			End If
			PlaySound "click"
			can2Play.State=1
			BallstoPlay2=BallsPerGame
			BallsText2.Text=BallstoPlay2		
		End If
	End If

	If Keycode= 6 then
		playsound "coin3"
		If credits<47 then Credits=Credits+1:DOF 119, DOFOn:end if
		Credittext.text=Credits
		CreditsReel.SetValue(Credits)
		If B2SOn Then Controller.B2SSetCredits Credits
	End If

End Sub

Sub DoubleBarrel_KeyUp(ByVal keycode)
	If keycode = PlungerKey Then
		Plunger.Fire
		PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
	End If

	If Tilt=0 and GameinProgress=1 Then
		If keycode = LeftFlipperKey Then SolLFlipper 0
		If keycode = RightFlipperKey Then SolRFlipper 0
	End If

	If GameinProgress=0 Then 'JP's LUT Control 
		If keycode = LeftMagnaSave Then bLutActive = False: LutBox.text = "" 
	End If

    'Manual Ball Control
	If EnableBallControl = 1 Then
		If keycode = 203 Then BCleft = 0	' Left Arrow
		If keycode = 200 Then BCup = 0		' Up Arrow
		If keycode = 208 Then BCdown = 0	' Down Arrow
		If keycode = 205 Then BCright = 0	' Right Arrow
	End If
End Sub

'*******************
'  Flipper Subs
'*******************

SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"

Sub SolLFlipper(Enabled)
    If Enabled Then
        PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper
		PlaySound "buzzl",-1
        LeftFlipper.RotateToEnd
    Else
        PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper
		StopSound "buzzl"
        LeftFlipper.RotateToStart
    End If
End Sub

Sub SolRFlipper(Enabled)
    If Enabled Then
        PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper
		PlaySound "buzz",-1
        RightFlipper.RotateToEnd
    Else
        PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper
		StopSound "buzz"
        RightFlipper.RotateToStart
    End If
End Sub

Sub LeftFlipper_Collide(parm)
    PlaySound "fx_rubber2", 0, parm / 60, Audiopan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
End Sub

Sub RightFlipper_Collide(parm)
    PlaySound "fx_rubber2", 0, parm / 60, Audiopan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
End Sub

'**********************************************
'    Flipper adjustments - enable tricks
'             by JLouLouLou
'**********************************************

Dim FlipperPower
Dim FlipperElasticity
Dim EOSTorque, EOSAngle
Dim SOSTorque, SOSAngle
Dim FullStrokeEOS_Torque

Dim LLiveCatchTimer
Dim RLiveCatchTimer
Dim LiveCatchSensivity

FlipperPower = 5000
FlipperElasticity = 0.25
EOSTorque = 0.2
EOSAngle = 6
SOSTorque = 0.1
SOSAngle = 6
FullStrokeEOS_Torque = 0.5
LiveCatchSensivity = 25 'adjust as you prefer
LLiveCatchTimer = 0
RLiveCatchTimer = 0

Sub RealTimeFast_Timer 'flipper's tricks timer
    'Flipper Stroke Routine
    If LeftFlipper.CurrentAngle => LeftFlipper.StartAngle - SOSAngle Then LeftFlipper.Strength = FlipperPower * SOSTorque:End If                                                       'Start of Stroke for Tap pass and Tap shoot
    If LeftFlipper.CurrentAngle < LeftFlipper.StartAngle - SOSAngle and LeftFlipper.CurrentAngle > LeftFlipper.EndAngle + EOSAngle Then LeftFlipper.Strength = FlipperPower:End If      'Full Stroke
    If LeftFlipper.CurrentAngle < LeftFlipper.EndAngle + EOSAngle and LeftFlipper.CurrentAngle > LeftFlipper.EndAngle Then LeftFlipper.Strength = FlipperPower * EOSTorque:End If       'EOS Stroke
    If LeftFlipper.CurrentAngle = LeftFlipper.EndAngle Then LeftFlipper.Strength = FlipperPower * FullStrokeEOS_Torque:End If                                                           'Bunny Bump Remover

    If RightFlipper.CurrentAngle <= RightFlipper.StartAngle + SOSAngle Then RightFlipper.Strength = FlipperPower * SOSTorque:End If                                                     'Start of Stroke for Tap pass and Tap shoot
    If RightFlipper.CurrentAngle > RightFlipper.StartAngle + SOSAngle and RightFlipper.CurrentAngle < RightFlipper.EndAngle - EOSAngle Then RightFlipper.Strength = FlipperPower:End If 'Full Stroke
    If RightFlipper.CurrentAngle > RightFlipper.EndAngle - EOSAngle and RightFlipper.CurrentAngle < RightFlipper.EndAngle Then RightFlipper.Strength = FlipperPower * EOSTorque:End If  'EOS Stroke
    If RightFlipper.CurrentAngle = RightFlipper.EndAngle Then RightFlipper.Strength = FlipperPower * FullStrokeEOS_Torque:End If                                                        'Bunny Bump Remover

    'Live Catch Routine
    If LeftFlipper.CurrentAngle <= LeftFlipper.EndAngle + EOSAngle and LeftFlipper.CurrentAngle => LeftFlipper.EndAngle Then
        LLiveCatchTimer = LLiveCatchTimer + 1
        If LLiveCatchTimer < LiveCatchSensivity Then
            LeftFlipper.Elasticity = 0.2
        Else
            LeftFlipper.Elasticity = FlipperElasticity
            LLiveCatchTimer = LiveCatchSensivity
        End If
    Else
        LLiveCatchTimer = 0
    End If
    If RightFlipper.CurrentAngle => RightFlipper.EndAngle - EOSAngle and RightFlipper.CurrentAngle <= RightFlipper.EndAngle Then
        RLiveCatchTimer = RLiveCatchTimer + 1
        If RLiveCatchTimer < LiveCatchSensivity Then
            RightFlipper.Elasticity = 0.2
        Else
            RightFlipper.Elasticity = FlipperElasticity
            RLiveCatchTimer = LiveCatchSensivity
        End If
    Else
        RLiveCatchTimer = 0
    End If
End Sub

Sub BallLifter_Timer
	BallLifter.enabled=false
	playsound SoundFXDOF ("DBBallup", 115, DOFPulse, DOFContactors)
	BallLifter2.enabled=true
End Sub

Sub BallLifter2_Timer 
	BallRelease.CreateBall
	BallRelease.kick 270,2
	ballinlane=1
	BallLifter2.enabled=false
End Sub

Sub TiltTimer_Timer
	If TiltSensor>1 then TiltSensor=TiltSensor-1
	If TiltSensor>99 then 
		TiltSensor=0
		If Tilt=0 then playsound "buzzer" End If
		Tilt=1
		If PlayerUp=1 Then
			TiltLight.SetValue 1
			If B2SOn Then Controller.B2SSetdata 44,1 'Tilt1
		Else 
			TiltLight2.SetValue 1
			If B2SOn Then Controller.B2SSetdata 45,1 'Tilt2
		End If
	End If
End Sub

Sub Start_Game()
	If GameStart=1 and GameinProgress=1 then
		Score(0)=0
		ScoreText.Text="0"
		Score(1)=0
		ScoreText2.Text="0"
		EMReel001.setvalue(0)
		EMReel002.setvalue(0)
		If B2SOn then
			Controller.B2SSetGameOver 35,0 'Gameover Off
			Controller.B2SSetScorePlayer 1, Score(0) 'Player 1 Score
			Controller.B2SSetScorePlayer 2, Score(1) 'Player 2 Score
			Controller.B2SSetdata 40,1 'Player 1 Up
			Controller.B2SSetdata 44,0 'Tilt1
			Controller.B2SSetdata 45,0 'Tilt2
			Controller.B2SSetdata 50,1 'BIP1
			Controller.B2SSetdata 55,1 'Snippet
			Controller.B2SSetmatch 34,0 'Match Off
		End If
		New_Ball
		TiltLight.SetValue 0
		TiltLight2.SetValue 0
		Tilt=0
		gball=0
		BIPLight001.SetValue 1
		GameOver.SetValue 0
		GameOverL.State=0 'Gameover DT Off
		GameOverL2.State=0 'Gameover DT Off
		BonusCount=0
		GobbleBonus=0
		PlayerUp=1
		Player1UpLight.State=1

		For Each X in MatchDT
			X.visible=0
			Next

		If LifterOption = 2 Then
			If BallinLane=0 and BallstoPlay>0 Then
				BallLifter.Enabled=True
			End If
		End If  '1 = manual lifter...2 = auto lifter

		
		dim xx
		For each xx in GI:xx.State = 1: Next 'GI Lights On

		Dim i
		for i = 0 to 49
			Collection2(i).Visible=0
			Collection2(i).collidable=false
			Collection2(i).hashitevent=False
		Next

		CenterT050.Collidable=True
		CenterT050.Hashitevent=True

		movetarget=0
		movetargetup=0
		movetargetupcount=0
		movedirection=1
		MovingTargetTimer.enabled=true
		PtargetC.objroty=((movetarget*.8)-20.5)*-1
		Target30.State=1
		Target100.State=0
		PBumperLight001.State=1
		PBumperLight002.State=1
		PBumperLight003.State=0
		GBL30.State=1
		GBR30.State=1
		GBL100.State=0
		GBL200.State=0
		GBL300.State=0
		GBR100.State=0
		GBR200.State=0
		GBL300.State=0
		Bumper1Light.State=0
		Bumper2Light.State=0
		LeftTriggerLight.State=1
		RightTriggerLight.State=1
		BumperOffLight.State=1

	End If
End Sub

Sub New_Ball
	DOF 118, DOFPulse
	ballinlane=0
End Sub

Sub Gate001_hit()
	PlaySound "Gate5",0,1,AudioPan(Gate001),0.25,0,0,1,AudioFade(Gate001)
End Sub

Sub RubberWall_hit()
	PlaySound "rubber_hit_3" 
End Sub


Sub Drain_Hit()
	If can2Play.State=0 Then SinglePlayer()
	If can2Play.State=1 Then Multiplayers()
End Sub

Sub SinglePlayer()
	PlaySound "drain"
	DOF 116, DOFPulse
	TiltLight.SetValue 0
	Tilt=0
	Drain.DestroyBall
	If B2SOn then Controller.B2SSetdata 44,0 'Tilt1
	BallstoPlay=BallstoPlay-1
	If BallstoPlay=0 then
		EndofGame()
		GameOver.SetValue 1
		GameOverL.State=1 'Gameover DT On
		GameOverL2.State=1 'Gameover DT On
		LeftFlipper.RotateToStart
		RightFlipper.RotateToStart
		If B2SOn then Controller.B2SSetGameOver 1
		playsound "motorleer"
		If score(0)>HighScore Then
			HighScore=score(0)
			HighScoreEntryInit()
			UpdatePostIt
			savehs
		End if
	End If

	If LifterOption=1 AND BallstoPlay>0 then
		Credittext.Text=Credits
		CreditsReel.SetValue(Credits)
		If B2SOn Then Controller.B2SSetCredits Credits
		BallsText.Text=BallstoPlay
		BallCalc()
		New_Ball
	End If  '1 = manual lifter...2 = auto lifter


	If LifterOption=2 AND BallstoPlay>0 then
		Credittext.Text=Credits
		CreditsReel.SetValue(Credits)
		If B2SOn Then Controller.B2SSetCredits Credits
		BallsText.Text=BallstoPlay
		BallCalc()
		New_Ball
			If LifterOption=2 and Ballinlane=0 and ballstoplay>0 then
				BallLifter.Enabled=True
			End If
	End If  '1 = manual lifter...2 = auto lifter
End Sub

Sub Multiplayers()
	If PlayerUp=1 Then ' Two Players - Player One
		If BallstoPlay>0 Then
			PlaySound "drain"
			DOF 116, DOFPulse
			TiltLight.SetValue 0
			Tilt=0
			Drain.DestroyBall
			BallstoPlay=BallstoPlay-1
			BallsText.Text=BallstoPlay
			BallCalc()
			PlayerUp=PlayerUp+1
			Player1UpLight.State=0
			Player2UpLight.State=1
            If B2SOn Then 
				Controller.B2SSetdata 40,0 'Player 1 Up
				Controller.B2SSetdata 41,1 'Player 2 Up
				Controller.B2SSetdata 44,0 'Tilt1
			End If
			If BallstoPlay2>0 Then PlayerNextUp()
			If B2SOn then Controller.B2SSetTilt 0
			If BallstoPlay=0 And score(0)>HighScore Then
				HighScore=score(0)
				HighScoreEntryInit()
				UpdatePostIt
				savehs
			End If
		End If

	Else
		If BallstoPlay2>0 Then ' Two Players - Player Two
			PlaySound "drain"
			DOF 116, DOFPulse
			TiltLight2.SetValue 0
			Tilt=0
			Drain.DestroyBall
			BallstoPlay2=BallstoPlay2-1
			BallsText2.Text=BallstoPlay2
			BallCalc()
			PlayerUp=PlayerUp-1
			Player1UpLight.State=1
			Player2UpLight.State=0
			If BallstoPlay>0 Then PlayerNextUp()
			If B2SOn Then
				Controller.B2SSetdata 40,1 'Player 1 Up
				Controller.B2SSetdata 41,0 'Player 2 Up
				Controller.B2SSetdata 45,0 'Tilt2
			End If
			If BallstoPlay2=0 then
				EndofGame()
				GameOver.SetValue 1
				GameOverL.State=1 'Gameover DT On
				GameOverL2.State=1 'Gameover DT On
				LeftFlipper.RotateToStart
				RightFlipper.RotateToStart
				If B2SOn then Controller.B2SSetGameOver 1
				playsound "motorleer"
				If Score(1)>HighScore Then
					HighScore=score(1)
					HighScoreEntryInit()
					UpdatePostIt
					savehs
				End If
			End If
		End If
	End If
End Sub

Sub PlayerNextUp()
		If LifterOption=1 Then New_Ball 
		If LifterOption=2 Then New_Ball:BallLifter.Enabled=True '1 = manual lifter...2 = auto lifter
End Sub

'*****Skill Holes

Sub gobblerr_Hit()
	Gobr_Score()
	gobblerR.TimerEnabled=True
	gobblerr.TimerInterval=2000
	Set aBall=ActiveBall			' aBall = the ball Being Gobbled
	aXpos=aBall.X
	aXadd=(gobblerR.X-aXpos)/15			' 15 ticks to roll ball into hole
	aYpos=aBall.Y
	aYadd=(gobblerR.Y-aYpos)/15
	aBall.X=aXpos					' Put Ball Back
	aBall.Y=aYpos
	aZpos=50						' Including Starting Height
	aBall.Z=aZPos
	aBall.VelX=0					' Stop It Rolling
	aBall.VelY=0
	gobblerR.TimerInterval=3			' Set timer to 3ms
	gobblerR.TimerEnabled=True			' And Turn It On
End Sub

Sub gobblerr_Timer()
	aZpos = aZpos - 1				'Subtract 1 from ball Z position and repeat the line above
	If aZpos > 25 Then
		aYpos = aYpos + aYadd		' Move X & X towards Hole Center
		aXpos = aXpos + aXadd
		wall016r.visible=0
	Else
		aYpos=gobblerR.Y					'Ball Now in the hole
		aXpos=gobblerR.X
	End If
	aBall.Z=aZpos					' Move the ball Z position to the value of variable aZpos
	aBall.X=aXpos					' Roll to Center of Kicker
	aBall.Y=aYpos
	aBall.VelX=0					' Stop It Really Rolling
	aBall.VelY=0
	If aZpos > -40 Then				'If the ball Z position is above -30 cycle
		Exit Sub
	End If
	Wall016r.visible=1
	gobblerR.TimerEnabled=False			' Stop this timer
	gobblerR.DestroyBall						' Delete Ball From Table
	Gob_End()
End Sub

Sub gobblerl_Hit()
	Gobl_Score()
	gobblerl.TimerEnabled=True
	gobblerl.TimerInterval=2000
	Set aBall=ActiveBall			' aBall = the ball Being Gobbled
	aXpos=aBall.X
	aXadd=(gobblerl.X-aXpos)/15			' 15 ticks to roll ball into hole
	aYpos=aBall.Y
	aYadd=(gobblerl.Y-aYpos)/15
	aBall.X=aXpos					' Put Ball Back
	aBall.Y=aYpos
	aZpos=50						' Including Starting Height
	aBall.Z=aZPos
	aBall.VelX=0					' Stop It Rolling
	aBall.VelY=0
	gobblerl.TimerInterval=3			' Set timer to 3ms
	gobblerl.TimerEnabled=True			' And Turn It On
End Sub

Sub gobblerl_Timer()
	aZpos = aZpos - 1				'Subtract 1 from ball Z position and repeat the line above
	If aZpos > 25 Then
		aYpos = aYpos + aYadd		' Move X & X towards Hole Center
		aXpos = aXpos + aXadd
		wall016.visible=0
	Else
		aYpos=gobblerL.Y					'Ball Now in the hole
		aXpos=gobblerL.X
	End If
	aBall.Z=aZpos					' Move the ball Z position to the value of variable aZpos
	aBall.X=aXpos					' Roll to Center of Kicker
	aBall.Y=aYpos
	aBall.VelX=0					' Stop It Really Rolling
	aBall.VelY=0
	If aZpos > -40 Then				'If the ball Z position is above -30 cycle
		Exit Sub
	End If
	Wall016.visible=1
	gobblerl.TimerEnabled=False			' Stop this timer
	gobblerl.DestroyBall						' Delete Ball From Table
	Gob_End()
End Sub

Sub Gobr_Score()
	If Tilt=0 Then	
		If GBR30.State=1 Then AddScore(30): PlaySound"30"
		If GBR100.State=1 Then AddScore(100): PlaySound"100"
		If GBR200.State=1 Then AddScore(200): PlaySound"200"
		If GBR300.State=1 Then AddScore(300): PlaySound"300"
		Gob_Reset
	End If
End Sub

Sub Gobl_Score()
	If Tilt=0 Then	
		If GBL30.State=1 Then AddScore(30): PlaySound"30"
		If GBL100.State=1 Then AddScore(100): PlaySound"100"
		If GBL200.State=1 Then AddScore(200): PlaySound"200"
		If GBL300.State=1 Then AddScore(300): PlaySound"300"
		Gob_Reset()
	End If
End Sub		

Sub Gob_Reset()
	GBL30.State=1
	GBR30.State=1
	GBL100.State=0
	GBR100.State=0
	GBL200.State=0
	GBR200.State=0
	GBL300.State=0
	GBR300.State=0
	GobbleBonus=0
End Sub


Sub Gob_End()
	playsound"GobbleFF"
	gobend.interval=1000
	gobend.Enabled=True
End Sub

sub gobend_timer()
	gobend.Enabled=0
	Drain_Hit
end Sub

'*****Slingshots

Sub RightSlingShot_Slingshot
	If Tilt=0 then
		playsound SoundFXDOF("right_slingshot",104,DOFPulse,DOFContactors),0,1, 0.05, 0.05
		DOF 106, DOFPulse
		RSling0.Visible = 0
		RSling1.Visible = 1
		sling1.TransZ = -20
		RStep = 0
		RightSlingShot.TimerEnabled = 1
		Addscore (1)
		PlaySound "1", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
	End If
End Sub

Sub RightSlingShot_Timer
    Select Case RStep
        Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
        Case 4:RSLing2.Visible = 0:RSling0.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
    End Select
    RStep = RStep + 1
End Sub

Sub LeftSlingShot_Slingshot
	If Tilt=0 Then
		playsound SoundFXDOF("left_slingshot",103,DOFPulse,DOFContactors),0,1, -0.05, 0.05
		DOF 105, DOFPulse
		LSling0.Visible = 0
		LSling1.Visible = 1
		sling2.TransZ = -20
		LStep = 0
		LeftSlingShot.TimerEnabled = 1
		Addscore (1)
		PlaySound "1", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
	End If
End Sub

Sub LeftSlingShot_Timer
    Select Case LStep
        Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
        Case 4:LSLing2.Visible = 0:LSLing0.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
    End Select
    LStep = LStep + 1
End Sub

'*****Leaf Switches

Sub Leaf001_Slingshot()
	If Tilt=0 Then
		PlaySound "1", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(1)
	End If
End Sub

Sub Leaf002_Slingshot()
	If Tilt=0 Then
		PlaySound "1", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(1)
	End If
End Sub

Sub Leaf003_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

Sub Leaf004_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

Sub Leaf005_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

Sub Leaf006_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

Sub Leaf007_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

Sub Leaf008_Slingshot()
	If Tilt=0 Then
		PlaySound "10", 0, Vol(ActiveBall)*400, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
		AddScore(10)
	End If
End Sub

'*****Moving Target

sub MovingTargetTimer_timer
	if movedirection=1 Then	
		Collection2(movetarget).visible=0
		Collection2(movetarget).collidable=False
		Collection2(movetarget).hashitevent=False
		movetarget=movetarget+1
'		Collection2(movetarget).visible=1
		Collection2(movetarget).collidable=True
		Collection2(movetarget).hashitevent=True

		if movetarget>48 then 
			movedirection=0
		end If
		PtargetC.objroty=((movetarget*.8)-20.5)*-1
		exit sub
	Else
		Collection2(movetarget).Visible=0
		Collection2(movetarget).collidable=False
		Collection2(movetarget).hashitevent=False
		
		movetarget=movetarget-1
'		Collection2(movetarget).visible=1
		Collection2(movetarget).collidable=True
		Collection2(movetarget).hashitevent=True

		if movetarget<1 then 
			movedirection=1
		end If
	end If
	PtargetC.objroty=((movetarget*.8)-20.5)*-1

end sub 


Sub Collection2_hit(idx)
	If Tilt=0 then
		If Target30.state=1 then AddScore(30):PlaySound"30"
		If Target100.state=1 then AddScore(100):PlaySound"100"
		GobbleBonus=GobbleBonus+1
		LightSwitch3()
	end if
end sub

Sub TargetWall_hit()
	If Tilt=0 Then
		PlaySound "1"
		AddScore(1)
	End If
End Sub

'*****Stationary Targets

Sub LeftTarget_Hit()
	If Tilt=0 then 
		PlaySound "10"
		AddScore(10)
	Else 
		PlaySound "pinhit_low"
	End If
End Sub

Sub RightTarget_Hit()
	If Tilt=0 then 
		PlaySound "10"
		AddScore(10)
	Else 
		PlaySound "pinhit_low"
	End If
End Sub

'*****Triggers

Sub YellowTrigger_Hit()
	If Tilt=0 Then
		Bumper1Light.State=1
		If PBumperLight001.State=1 and PBumperLight002.State=1 Then
			PlaySound "30"
			AddScore(30)
		Else
			PlaySound "10"
			AddScore(10)
		End If
	End If
End Sub

Sub GreenTrigger_Hit()
	If Tilt=0 Then
		Bumper2Light.State=1
		If PBumperLight002.State=1 and PBumperLight003.State=1 Then
			PlaySound "30"
			AddScore(30)
		Else
			PlaySound "10"
			AddScore(10)
		End If
	End If
End Sub

Sub BumpersOffTrigger_Hit()
	If Tilt=0 Then 
		PlaySound "click"
		Bumper1Light.State=0
		Bumper2Light.State=0
	End If
End Sub

Sub BottomLeftTrigger_Hit()
	If Tilt=0 Then
		If PBumperLight001.State=1 Then 
			PBumperLight001.State=0
			PBumperLight003.State=1
		Else
			PBumperLight003.State=0
			PBumperLight001.State=1
		End If
		PlaySound "1"
		AddScore(1)
		BonusCount=BonusCount+1
		LightSwitch1()
		LightSwitch2()
	End If
End Sub

Sub BottomRightTrigger_Hit()
	If Tilt=0 Then
		If PBumperLight001.State=1 Then 
			PBumperLight001.State=0
			PBumperLight003.State=1
		Else
			PBumperLight003.State=0
			PBumperLight001.State=1
		End If
		PlaySound "1"
		AddScore(1)
		BonusCount=BonusCount+1
		LightSwitch1()
		LightSwitch2()
	End If
End Sub

'*****Bumpers

Sub Bumper1_Hit 'Green Bumper
	If Tilt=0 then
		If Bumper1Light.State=0 Then
			AddScore (1)
			PlaySound "1"
			PlaySound SoundFXDOF("fx_bumper4", 107, DOFPulse, DOFContactors), 0,1,AudioPan(Bumper1),0,0,0,1,AudioFade(Bumper1)
			DOF 109, DOFPulse
		Else
			AddScore (10)
			PlaySound "10"
			PlaySound SoundFXDOF("fx_bumper4", 107, DOFPulse, DOFContactors), 0,1,AudioPan(Bumper1),0,0,0,1,AudioFade(Bumper1)
			DOF 109, DOFPulse
		End If
	End If
End Sub

Sub Bumper1_Timer
'	Add timer events if needed
End Sub

Sub Bumper2_Hit 'Yellow Bumper
	If Tilt=0 then
		If Bumper2Light.State=0 Then
			AddScore (1)
			PlaySound "1"
			PlaySound SoundFXDOF("fx_bumper4", 109, DOFPulse, DOFContactors), 0,1,AudioPan(Bumper2),0,0,0,1,AudioFade(Bumper2)
			DOF 111, DOFPulse
		Else
			AddScore (10)
			PlaySound "10"
			PlaySound SoundFXDOF("fx_bumper4", 109, DOFPulse, DOFContactors), 0,1,AudioPan(Bumper2),0,0,0,1,AudioFade(Bumper2)
			DOF 111, DOFPulse
		End If
	End If
End Sub

Sub Bumper2_Timer
'	Add timer events if needed
End Sub

'*****Passive Bumpers

Sub PBumper001_Hit 
	If Tilt=0 then
		AddScore (1)
		PlaySound "1"
		PlaySound SoundFXDOF("fx_bumper4", 107, DOFPulse, DOFContactors), 0,1,AudioPan(PBumper001),0,0,0,1,AudioFade(PBumper001)
		DOF 109, DOFPulse
		BonusCount=BonusCount+1
		LightSwitch1()
		LightSwitch2()
	End If
End Sub

Sub PBumper001_Timer
'	Add timer events if needed
End Sub

Sub PBumper002_Hit 
	If Tilt=0 then
		AddScore (10)
		PlaySound "10"
		PlaySound SoundFXDOF("fx_bumper4", 107, DOFPulse, DOFContactors), 0,1,AudioPan(PBumper002),0,0,0,1,AudioFade(PBumper002)
		DOF 109, DOFPulse
		BonusCount=BonusCount+1
		LightSwitch1()
		LightSwitch2()
	End If
End Sub

Sub PBumper002_Timer
'	Add timer events if needed
End Sub

Sub PBumper003_Hit 
	If Tilt=0 then
		AddScore (1)
		PlaySound "1"
		PlaySound SoundFXDOF("fx_bumper4", 107, DOFPulse, DOFContactors), 0,1,AudioPan(PBumper003),0,0,0,1,AudioFade(PBumper003)
		DOF 109, DOFPulse
		BonusCount=BonusCount+1
		LightSwitch1()
		LightSwitch2()
	End If
End Sub

Sub PBumper003_Timer
'	Add timer events if needed
End Sub

'*****Kickers

Sub LeftKicker_Hit()            'routine name
	LeftKicker.TimerInterval=450          '  .450 second timer
	LeftKicker.TimerEnabled = True         '  enables timer
    If Tilt = 0 then 
		Addscore(5)              'add a score of some type here
		PlaySound "5" 'play any sound you put in when ball first hits kicker   
	End If
End Sub

Sub LeftKicker_Timer()
    LeftKicker.kick 18-INT(RND()*20),30     'kick degree (+/-4) and power     
    If Tilt=0 then PlaySound "kicker",0,1,AudioPan(LeftKicker),0.25,0,0,1,AudioFade(LeftKicker)  'playsound when ball leaves kicker
    LeftKicker.Timerenabled = False    ' stops timer
End Sub

Sub RightKicker_Hit()            'routine name
	RightKicker.TimerInterval=450          '  .450 second timer
	RightKicker.TimerEnabled = True         '  enables timer
    If Tilt = 0 then 
		Addscore(5)              'add a score of some type here
		PlaySound "5" 'play any sound you put in when ball first hits kicker   
	End If
End Sub

Sub RightKicker_Timer()
    RightKicker.kick 315-INT(RND()*20),30   'kick degree (+/-4) and power          
    If Tilt=0 then PlaySound "kicker",0,1,AudioPan(RightKicker),0.25,0,0,1,AudioFade(RightKicker)  'playsound when ball leaves kicker
    RightKicker.Timerenabled = False    ' stops timer
End Sub

'*****Light Switches

Sub LightSwitch1() 'Target Bonus switches from 30 to 100 and back to 30 after every 5 target hits
	If BonusCount=5 Then	
		If Target30.State=1 Then
			Target30.State=0
			Target100.State=1
		Else
			Target100.State=0
			Target30.State=1
		End If
	BonusCount=0
	End If	
End Sub

Sub LightSwitch2()
	If LeftSide=1 Then
		LeftSide=0
		RightSide=1
	Else
		RightSide=0
		LeftSide=1
	End If
	LightSwitch4()
End Sub

Sub LightSwitch3()
	If LeftSide=1 And GobbleBonus=1 Then GBL30.State=0: GBL100.State=1
	If LeftSide=1 And GobbleBonus=2 Then GBL100.State=0: GBL200.State=1
	If LeftSide=1 And GobbleBonus>=3 Then GBL200.State=0: GBL300.State=1
	If RightSide=1 And GobbleBonus=1 Then GBR30.State=0: GBR100.State=1
	If RightSide=1 And GobbleBonus=2 Then GBR100.State=0: GBR200.State=1
	If RightSide=1 And GobbleBonus>=3 Then GBR200.State=0: GBR300.State=1
End Sub

Sub LightSwitch4()
	If LeftSide=1 and GobbleBonus=1 Then GBL100.State=1:GBR100.State=0: GBR30.State=1: GBL30.State=0
	If LeftSide=1 and GobbleBonus=2 Then GBL200.State=1:GBR200.State=0: GBR30.State=1: GBL30.State=0
	If LeftSide=1 and GobbleBonus>=3 Then GBL300.State=1:GBR300.State=0: GBR30.State=1: GBL30.State=0
	If RightSide=1 and GobbleBonus=1 Then GBR100.State=1:GBL100.State=0: GBL30.State=1: GBR30.State=0
	If RightSide=1 and GobbleBonus=2 Then GBR200.State=1:GBL200.State=0: GBL30.State=1: GBR30.State=0
	If RightSide=1 and GobbleBonus>=3 Then GBR300.State=1:GBL300.State=0: GBL30.State=1: GBR30.State=0
End Sub

'*****Scoring

Sub AddScore(ScorePar)
	If Tilt=1 Then Exit Sub
	Select Case ScorePar
		Case 1
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 5
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 10
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 30
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 100
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 200
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
		Case 300
			Score(PlayerUp-1)=Score(PlayerUp-1)+ScorePar
			DisplayScores
			ScoreBonus()
	End Select
	Matchnumber=Matchnumber+1
	If Matchnumber=11 Then Matchnumber=1
End Sub

Sub DisplayScores
	If B2SOn Then
		Controller.B2SSetScorePlayer PlayerUp, Score(PlayerUp-1)
	End If
    EMReel001.setvalue(Score(0))
	EMReel002.setvalue(Score(1))
	ScoreText.Text=FormatNumber(Score(0),0,-1,0,-1)
	ScoreText2.Text=FormatNumber(Score(1),0,-1,0,-1)
End Sub

Sub ScoreBonus()
	If BallsperGame=3 Then
		If Score(PlayerUp-1) >= 700 And BC1(PlayerUp-1)=False Then BC1(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 900 And BC2(PlayerUp-1)=False Then BC2(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1100 And BC3(PlayerUp-1)=False Then BC3(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1300 And BC4(PlayerUp-1)=False Then BC4(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1500 And BC4(PlayerUp-1)=False Then BC4(PlayerUp-1)=True:AddCredits()
	End If

	If BallsperGame=5 Then
		If Score(PlayerUp-1) >= 1100 And BC1(PlayerUp-1)=False Then BC1(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1300 And BC2(PlayerUp-1)=False Then BC2(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1500 And BC3(PlayerUp-1)=False Then BC3(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1700 And BC4(PlayerUp-1)=False Then BC4(PlayerUp-1)=True:AddCredits()
		If Score(PlayerUp-1) >= 1900 And BC4(PlayerUp-1)=False Then BC4(PlayerUp-1)=True:AddCredits()
	End If
End Sub

Sub AddCredits()
	Credits=Credits+1
	PlaySound SoundFXDOF ("knocke", 300, DOFPulse, DOFKnocker)
    DOF 230, DOFPulse
	CreditText.text=Credits
	CreditsReel.SetValue(Credits)
	If B2SOn Then Controller.B2SSetCredits Credits
End Sub


Sub Match()
    If B2SOn Then Controller.B2ssetmatch 34, matchnumber
	If DesktopMode = True then MatchDT(matchnumber-1).Visible = 1
    If Matchnumber=(Score(0) Mod 10) and Tilt=0 Then AddCredits()
    If Matchnumber=(Score(1) Mod 10) and Tilt=0 and Players = 2 Then AddCredits()
	MatchText.text=(Score(0) Mod 10)	
	MatchText2.text=Matchnumber	
End Sub

Sub BallCalc()
	If BallsperGame=5 Then
		If BallstoPlay=4 And BallstoPlay2=0 Then BIP=2
		If BallstoPlay=4 And BallstoPlay2=4 Then BIP=2
		If BallstoPlay=3 And BallstoPlay2=0 Then BIP=3
		If BallstoPlay=3 And BallstoPlay2=3 Then BIP=3
		If BallstoPlay=2 And BallstoPlay2=0 Then BIP=4
		If BallstoPlay=2 And BallstoPlay2=2 Then BIP=4
		If BallstoPlay=1 And BallstoPlay2=0 Then BIP=5
		If BallstoPlay=1 And BallstoPlay2=1 Then BIP=5
	Else
		If BallstoPlay=2 And BallstoPlay2=0 Then BIP=2
		If BallstoPlay=2 And BallstoPlay2=2 Then BIP=2
		If BallstoPlay=1 And BallstoPlay2=0 Then BIP=3
		If BallstoPlay=1 And BallstoPlay2=1 Then BIP=3
	End If
	BIPLights()
End Sub

Sub BIPLights()
	If BIP=1 Then BIPLight001.SetValue 1 Else BIPLight001.SetValue 0
	If BIP=2 Then BIPLight002.SetValue 1 Else BIPLight002.SetValue 0
	If BIP=3 Then BIPLight003.SetValue 1 Else BIPLight003.SetValue 0
	If BIP=4 Then BIPLight004.SetValue 1 Else BIPLight004.SetValue 0
	If BIP=5 Then BIPLight005.SetValue 1 Else BIPLight005.SetValue 0
	If B2SOn Then BIPLightsB2S()
End Sub

Sub BIPLightsB2S()
	If BIP=1 Then Controller.B2SSetdata 50,1 Else Controller.B2SSetdata 50,0 'BIP1
	If BIP=2 Then Controller.B2SSetdata 51,1 Else Controller.B2SSetdata 51,0 'BIP2
	If BIP=3 Then Controller.B2SSetdata 52,1 Else Controller.B2SSetdata 52,0 'BIP3
	If BIP=4 Then Controller.B2SSetdata 53,1 Else Controller.B2SSetdata 53,0 'BIP4
	If BIP=5 Then Controller.B2SSetdata 54,1 Else Controller.B2SSetdata 54,0 'BIP5
End Sub

Sub DoubleBarrel_Exit()
    savecreds
	If B2SOn Then Controller.Stop
End Sub


'==========================================================================================================================================
'============================================================= START OF HIGH SCORES ROUTINES =============================================================
'==========================================================================================================================================
'
'ADD LINE TO TABLE_KEYDOWN SUB WITH THE FOLLOWING:    If HSEnterMode Then HighScoreProcessKey(keycode) AFTER THE STARTGAME ENTRY
'ADD: And Not HSEnterMode=true TO IF KEYCODE=STARTGAMEKEY
'TO SHOW THE SCORE ON POST-IT ADD LINE AT RELEVENT LOCATION THAT HAS:  UpdatePostIt
'TO INITIATE ADDING INITIALS ADD LINE AT RELEVENT LOCATION THAT HAS:  HighScoreEntryInit()
'ADD THE FOLLOWING LINES TO TABLE_INIT TO SETUP POSTIT
'	if HSA1="" then HSA1=25
'	if HSA2="" then HSA2=25
'	if HSA3="" then HSA3=25
'	UpdatePostIt
'ADD HSA1, HSA2 AND HSA3 TO SAVE AND LOAD VALUES FOR TABLE
'ADD A TIMER NAMED HighScoreFlashTimer WITH INTERVAL 100 TO TABLE
'SET HSSSCOREX BELOW TO WHATEVER VARIABLE YOU USE FOR HIGH SCORE.
'ADD OBJECTS TO PLAYFIELD (EASIEST TO JUST COPY FROM THIS TABLE)
'IMPORT POST-IT IMAGES

dim brarray
brarray = array("ball go", "ball 1","ball 2","ball 3","ball 4","ball 5","ball")
sub ballaff(nbball)
dim nbll
	nbll=nbball
	if nbll>5 then nbll =6
	ballin.image = brarray(nbll)
end sub


Dim HSA1, HSA2, HSA3
Dim HSEnterMode, hsLetterFlash, hsEnteredDigits(3), hsCurrentDigit, hsCurrentLetter
Dim HSArray  
Dim HSScoreM,HSScore100k, HSScore10k, HSScoreK, HSScore100, HSScore10, HSScore1, HSScorex	'Define 6 different score values for each reel to use
HSArray = Array("Postit0","postit1","postit2","postit3","postit4","postit5","postit6","postit7","postit8","postit9","postitBL","postitCM","Tape")
Const hsFlashDelay = 4

' ***********************************************************
'  HiScore DISPLAY 
' ***********************************************************

Sub UpdatePostIt
	dim tempscore
	HSScorex = highscore
	TempScore = HSScorex
	HSScore1 = 0
	HSScore10 = 0
	HSScore100 = 0
	HSScoreK = 0
	HSScore10k = 0
	HSScore100k = 0
	HSScoreM = 0
	if len(TempScore) > 0 Then
		HSScore1 = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScore10 = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScore100 = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScoreK = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScore10k = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScore100k = cint(right(Tempscore,1))
	end If
	if len(TempScore) > 1 Then
		TempScore = Left(TempScore,len(TempScore)-1)
		HSScoreM = cint(right(Tempscore,1))
	end If
	Pscore6.image = HSArray(HSScoreM):If HSScorex<1000000 Then PScore6.image = HSArray(10)
	Pscore5.image = HSArray(HSScore100K):If HSScorex<100000 Then PScore5.image = HSArray(10)
	PScore4.image = HSArray(HSScore10K):If HSScorex<10000 Then PScore4.image = HSArray(10)
	PScore3.image = HSArray(HSScoreK):If HSScorex<1000 Then PScore3.image = HSArray(10)
	PScore2.image = HSArray(HSScore100):If HSScorex<100 Then PScore2.image = HSArray(10)
	PScore1.image = HSArray(HSScore10):If HSScorex<10 Then PScore1.image = HSArray(10)
	PScore0.image = HSArray(HSScore1):If HSScorex<1 Then PScore0.image = HSArray(10)
	if HSScorex<1000 then
		PComma.image = HSArray(10)
	else
		PComma.image = HSArray(11)
	end if
	if HSScorex<1000000 then
		PComma2.image = HSArray(10)
	else
		PComma2.image = HSArray(11)
	end if
'	if showhisc=1 and showhiscnames=1 then
'		for each object in hiscname:object.visible=1:next
		HSName1.image = ImgFromCode(HSA1, 1)
		HSName2.image = ImgFromCode(HSA2, 2)
		HSName3.image = ImgFromCode(HSA3, 3)
'	  else
'		for each object in hiscname:object.visible=0:next
'	end if
End Sub

Function ImgFromCode(code, digit)
	Dim Image
	if (HighScoreFlashTimer.Enabled = True and hsLetterFlash = 1 and digit = hsCurrentLetter) then
		Image = "postitBL"
	elseif (code + ASC("A") - 1) >= ASC("A") and (code + ASC("A") - 1) <= ASC("Z") then
		Image = "postit" & chr(code + ASC("A") - 1)
	elseif code = 27 Then
		Image = "PostitLT"
    elseif code = 0 Then
		image = "PostitSP"
    Else
      msgbox("Unknown display code: " & code)
	end if
	ImgFromCode = Image
End Function

Sub HighScoreEntryInit()
	HSA1=0:HSA2=0:HSA3=0
	HSEnterMode = True
	hsCurrentDigit = 0
	hsCurrentLetter = 1:HSA1=1
	HighScoreFlashTimer.Interval = 250
	HighScoreFlashTimer.Enabled = True
	hsLetterFlash = hsFlashDelay
End Sub

Sub HighScoreFlashTimer_Timer()
	hsLetterFlash = hsLetterFlash-1
	UpdatePostIt
	If hsLetterFlash=0 then 'switch back
		hsLetterFlash = hsFlashDelay
	end if
End Sub


' ***********************************************************
'  HiScore ENTER INITIALS 
' ***********************************************************

Sub HighScoreProcessKey(keycode)
    If keycode = LeftFlipperKey Then
		hsLetterFlash = hsFlashDelay
		Select Case hsCurrentLetter
			Case 1:
				HSA1=HSA1-1:If HSA1=-1 Then HSA1=26 'no backspace on 1st digit
				UpdatePostIt
			Case 2:
				HSA2=HSA2-1:If HSA2=-1 Then HSA2=27
				UpdatePostIt
			Case 3:
				HSA3=HSA3-1:If HSA3=-1 Then HSA3=27
				UpdatePostIt
		 End Select
    End If

	If keycode = RightFlipperKey Then
		hsLetterFlash = hsFlashDelay
		Select Case hsCurrentLetter
			Case 1:
				HSA1=HSA1+1:If HSA1>26 Then HSA1=0
				UpdatePostIt
			Case 2:
				HSA2=HSA2+1:If HSA2>27 Then HSA2=0
				UpdatePostIt
			Case 3:
				HSA3=HSA3+1:If HSA3>27 Then HSA3=0
				UpdatePostIt
		 End Select
	End If
	
    If keycode = PlungerKey Then
		Select Case hsCurrentLetter
			Case 1:
				hsCurrentLetter=2 'ok to advance
				HSA2=HSA1 'start at same alphabet spot
'				EMReelHSName1.SetValue HSA1:EMReelHSName2.SetValue HSA2
			Case 2:
				If HSA2=27 Then 'bksp
					HSA2=0
					hsCurrentLetter=1
				Else
					hsCurrentLetter=3 'enter it
					HSA3=HSA2 'start at same alphabet spot
				End If
			Case 3:
				If HSA3=27 Then 'bksp
					HSA3=0
					hsCurrentLetter=2
				Else
					savehs 'enter it
					HighScoreFlashTimer.Enabled = False
					HSEnterMode = False
				End If
		End Select
		UpdatePostIt
    End If
End Sub
sub savehs
    savevalue "DoubleBarrel", "hiscore", Highscore
    savevalue "DoubleBarrel", "score1", score
	savevalue "DoubleBarrel", "hsa1", HSA1
	savevalue "DoubleBarrel", "hsa2", HSA2
	savevalue "DoubleBarrel", "hsa3", HSA3
end sub

sub loadhs
    dim temp
    temp = LoadValue("DoubleBarrel", "hiscore")
    If (temp <> "") then Highscore = CDbl(temp)
    temp = LoadValue("DoubleBarrel", "score1")
    If (temp <> "") then score(0) = CDbl(temp)
	temp = LoadValue("DoubleBarrel", "hsa1")
    If (temp <> "") then HSA1 = CDbl(temp)
    temp = LoadValue("DoubleBarrel", "hsa2")
    If (temp <> "") then HSA2 = CDbl(temp)
    temp = LoadValue("DoubleBarrel", "hsa3")
    If (temp <> "") then HSA3 = CDbl(temp)
end sub

sub savecreds
    savevalue "DoubleBarrel1", "credit", Credits
end sub

sub loadcreds
    dim temp
	temp = LoadValue("DoubleBarrel1", "credit")
    If (temp <> "") then Credits = CDbl(temp)
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 v3.0
'  includes random pitch in PlaySoundAt and PlaySoundAtBall
'***************************************************************

Dim TableWidth, TableHeight

TableWidth = DoubleBarrel.width
TableHeight = DoubleBarrel.height

Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
    Vol = Csng(BallVel(ball) ^2 / 2000)
End Function

Function AudioPan(ball) ' Calculates the pan for a ball based on the X position on the table. "DoubleBarrel" is the name of the table
    Dim tmp
    tmp = ball.x * 2 / TableWidth-1
    If tmp > 0 Then
        AudioPan = Csng(tmp ^10)
    Else
        AudioPan = 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 = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
End Function

Function AudioFade(ball) 'only on VPX 10.4 and newer
    Dim tmp
    tmp = ball.y * 2 / TableHeight-1
    If tmp > 0 Then
        AudioFade = Csng(tmp ^10)
    Else
        AudioFade = Csng(-((- tmp) ^10))
    End If
End Function

Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
    PlaySound soundname, 0, 1, AudioPan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
End Sub

Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
    PlaySound soundname, 0, Vol(ActiveBall), Audiopan(ActiveBall), 0.2, Pitch(ActiveBall) * 10, 0, 0, AudioFade(ActiveBall)
End Sub

Function RndNbr(n) 'returns a random number between 1 and n
    Randomize timer
    RndNbr = Int((n * Rnd) + 1)
End Function

'*****************************************
'   rothbauerw's Manual Ball Control
'*****************************************

Dim BCup, BCdown, BCleft, BCright
Dim ControlBallInPlay, ControlActiveBall
Dim BCvel, BCyveloffset, BCboostmulti, BCboost

BCboost = 1				'Do Not Change - default setting
BCvel = 4				'Controls the speed of the ball movement
BCyveloffset = -0.01 	'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
BCboostmulti = 3		'Boost multiplier to ball veloctiy (toggled with the B key) 

ControlBallInPlay = false

Sub StartBallControl_Hit()
	Set ControlActiveBall = ActiveBall
	ControlBallInPlay = true
End Sub

Sub StopBallControl_Hit()
	ControlBallInPlay = false
End Sub	

Sub BallControlTimer_Timer()
	If EnableBallControl and ControlBallInPlay then
		If BCright = 1 Then
			ControlActiveBall.velx =  BCvel*BCboost
		ElseIf BCleft = 1 Then
			ControlActiveBall.velx = -BCvel*BCboost
		Else
			ControlActiveBall.velx = 0
		End If

		If BCup = 1 Then
			ControlActiveBall.vely = -BCvel*BCboost
		ElseIf BCdown = 1 Then
			ControlActiveBall.vely =  BCvel*BCboost
		Else
			ControlActiveBall.vely = bcyveloffset
		End If
	End If
End Sub

'*************
'   JP'S LUT
' 	Images by vogliadicane
'*************

Dim bLutActive, LUTImage

Sub LoadLUT
    Dim x
    bLutActive = False
    x = LoadValue(cGameName, "LUTImage")
    If(x <> "")Then LUTImage = x Else LUTImage = 0
    UpdateLUT
End Sub

Sub SaveLUT
    SaveValue cGameName, "LUTImage", LUTImage
End Sub

Sub NextLUT:LUTImage = (LUTImage + 1)MOD 22:UpdateLUT:SaveLUT:Lutbox.text = "Color LUT Image: " & LUTImage + 1:End Sub

Sub UpdateLUT
    Select Case LutImage
        Case 0:DoubleBarrel.ColorGradeImage = "LUT0"
        Case 1:DoubleBarrel.ColorGradeImage = "LUT1"
        Case 2:DoubleBarrel.ColorGradeImage = "LUT2"
        Case 3:DoubleBarrel.ColorGradeImage = "LUT3"
        Case 4:DoubleBarrel.ColorGradeImage = "LUT4"
        Case 5:DoubleBarrel.ColorGradeImage = "LUT5"
        Case 6:DoubleBarrel.ColorGradeImage = "LUT6"
        Case 7:DoubleBarrel.ColorGradeImage = "LUT7"
        Case 8:DoubleBarrel.ColorGradeImage = "LUT8"
        Case 9:DoubleBarrel.ColorGradeImage = "LUT9"
        Case 10:DoubleBarrel.ColorGradeImage = "LUT10"
        Case 11:DoubleBarrel.ColorGradeImage = "LUT Warm 0"
        Case 12:DoubleBarrel.ColorGradeImage = "LUT Warm 1"
        Case 13:DoubleBarrel.ColorGradeImage = "LUT Warm 2"
        Case 14:DoubleBarrel.ColorGradeImage = "LUT Warm 3"
        Case 15:DoubleBarrel.ColorGradeImage = "LUT Warm 4"
        Case 16:DoubleBarrel.ColorGradeImage = "LUT Warm 5"
        Case 17:DoubleBarrel.ColorGradeImage = "LUT Warm 6"
        Case 18:DoubleBarrel.ColorGradeImage = "LUT Warm 7"
        Case 19:DoubleBarrel.ColorGradeImage = "LUT Warm 8"
        Case 20:DoubleBarrel.ColorGradeImage = "LUT Warm 9"
        Case 21:DoubleBarrel.ColorGradeImage = "LUT Warm 10"
    End Select
End Sub

'********************************************************************
'      JP's VP10 Rolling Sounds (+rothbauerw's Dropping 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

    For b = 0 to UBound(BOT)
        ' play the rolling sound for each ball
        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

        ' play ball drop sounds
        If BOT(b).VelZ < -1 and BOT(b).z < 55 and BOT(b).z > 27 Then 'height adjust for ball drop sounds
            PlaySound "fx_ball_drop" & b, 0, ABS(BOT(b).velz)/17, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
        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 v2
'*****************************************

'Add TimerEnabled=True to DoubleBarrel_KeyDown procedure
' Example :
'Sub DoubleBarrel_KeyDown(ByVal keycode)
'    If keycode = LeftFlipperKey Then
'        LeftFlipper.TimerEnabled = True 'Add this
'        LeftFlipper.RotateToEnd
'    End If
'    If keycode = RightFlipperKey Then
'        RightFlipper.TimerEnabled = True 'And add this
'        RightFlipper.RotateToEnd
'    End If
'End Sub

Sub LeftFlipper_Init()
    LeftFlipper.TimerInterval = 10
End Sub

Sub RightFlipper_Init()
    RightFlipper.TimerInterval = 10
End Sub

Sub LeftFlipper_Timer()
	LFlip.RotZ = LeftFlipper.CurrentAngle
	LFlip1.RotZ = LeftFlipper.CurrentAngle
    FlipperLSh.RotZ = LeftFlipper.CurrentAngle
    If LeftFlipper.CurrentAngle = LeftFlipper.StartAngle Then
        LeftFlipper.TimerEnabled = False
    End If
End Sub

Sub RightFlipper_Timer()
	RFlip.RotZ = RightFlipper.CurrentAngle
	RFlip1.RotZ = RightFlipper.CurrentAngle
    FlipperRSh.RotZ = RightFlipper.CurrentAngle
    If RightFlipper.CurrentAngle = RightFlipper.StartAngle Then
        RightFlipper.TimerEnabled = False
    End If
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 < DoubleBarrel.Width/2 Then
            BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (DoubleBarrel.Width/2))/7)) + 6
        Else
            BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (DoubleBarrel.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

All I've changed is I fixed the flipper assignments (they seemed only half written for DOF) and I directed the DOFConfig to use a table with similar DOF assignments.  It's hacky, but it works!

Thank you!!


Other files you may be interested in ..





  • 18,269 Total Files
  • 57 Total Categories
  • 872 Total Authors
  • 25,271,369 Total Downloads
  • Grand Prix Latest File
  • Popotte Latest Submitter

user(s) are online (in the past 15 minutes)

members, guests, anonymous users