Ok I'll try. Hopefully I don't miss anything...
Overview: I added two variables - tilted and tiltmeter. tilted is a true / false variable which contains whether the machine is tilted or not. tiltmeter is how close the machine is to tilting - at 0 it's at rest, as you nudge it it increases - at 4 it tilts. I also added a timer (called tilt) to allow the tilt mechanism to settle down, otherwise 4 nudges at any point would tilt the table.
First, I Dimmed the new variables.
Then I initialized them in the table init code.
Code:
tilted = false
tiltlevel = 0
Then I added a timer named tilt. The timer interval controls how easy it is to tilt - the higher the number the easier it is to tilt (because it takes longer to "forget" about the previous nudge). I set it at 2000, you'll likely want to tweak that number. Basically what is going to happen is each time the table is nudged, tiltlevel will increase by 1, and each timer interval the tiltlevel will decrease by 1. A bit hard to explain, I hope you follow the logic...
Next I changed the flipper code to check the tilted variable to see if the machine was tilted or not before allowing the flippers to flip. We haven't programmed the tilted variable yet, but we will in a minute...
Code:
If keycode = LeftFlipperKey and tilted = false Then
LeftFlipper.RotateToEnd
PlaySound "FlipperUp"
End If
If keycode = RightFlipperKey and tilted = false Then
RightFlipper.RotateToEnd
PlaySound "FlipperUp"
End If
I added a sound called "tilt" to the sound manager so you'd be alerted when the table tilted. Then I edited the code for the nudges as shown below. I also changed it so you can't nudge the machine when it's tilted. I'll only show the left nudge code here, but I did the same for center and right nudge. I guess the more complicated you make the tilt handler (turning off lights, deadening bumpers, etc, none of which I did here) the more inefficient this is and you might want write a tilt handler sub instead. With only 3 lines of tilt handler code, I didn't bother.
Code:
If keycode = LeftTiltKey and tilted = false Then
Nudge 90, 2
TiltMeter.AddValue(4) ' TiltMeter animation '
tilt.enabled = true
tiltlevel = tiltlevel + 1
if tiltlevel > 4 then tilted = true: playsound "tilt"
End If
I then added code to reset the tilted variable when the ball drained.
Code:
Sub Drain_Hit()
tilted = false
Last is the timer routine, to control how the whole tiltmeter concept I detailed earlier works. Basically as time passes it reduces the tiltlevel until it hits zero, at which point it turns off the timer.
Code:
Sub tilt_Timer()
tiltlevel = tiltlevel - 1
if tiltlevel <= 0 then tilt.enabled = false
End Sub
I hope that's everything. I wanted the tiltmeter variable to control which reel in the tilt bubble displayed, but the order of the images in the reel made that a bit difficult so I skipped it.
Let me know if this makes any sense.