************************************************** *** Using shivaEngine for your own tables *** ************************************************** The codes needed to call the various main routines within your game *** Main Engine Code Routines *** Table1_Init() ' Initialize the table and set the variables to a known state. ' Also load the high score file. ' This is were variables can be set by the player Table1_KeyDown(ByVal keycode) 'This section holds the code that determines what happens when you press a key on your keyboard. Table1_KeyUp(ByVal keycode) ' This is what happens after you let go of a keypress. NewBall() ' Main Routine, controls what the game does for when ' a new ball is started OR ' what happens after a ball is ended Trough_Init() ' This kicks the ball to the plunger called by the ' NewBall() SUB to start a ball in play. ' Also used by the Multiball Routine and the quicktimer for Ball Save Drain_Hit() ' What happens when the ball is lost Started = True ' Disallows adding players once the first ball has been launched ======================== Scoring subroutine calls ======================== ' Just copy and paste these main codes into your table *** Score Points *** addscore 100 ' adds score - add a number for the score i.e. 100 points in this example addscore (100*2) ' Multiply 100 times 2. You can add a variables to this. ' i.e. addscore (1000*BonusMultiplier) or addscore (i-j) If tilt = False Then XXX ' Checks to make sure you haven't tilted ' If so, then it goes ahead ' i.e. If tilt = False Then addscore 500 *** Bonus *** BonusTimer.Enabled = True ' Calls Bonus Countdown ' look for "BonusTimer.Interval = 400" in Drain_Hit() Sub to change count speed AddBonus() ' Add a bonus Bonus ' Variable to store Bonus for Bonus Countdown HoldBonus ' 2nd variable to store bonus ' This is used for the countdown by Multiplier ' This is only the Bonus, no multiplier ' But you can use this for a "collect Bonus" feature ' i.e addscore = addscore+HoldBonus TAdvMult() ' Routine for adding Bonus Multiplier BonusCollect() ' Collect the bonus value unmultiplied ' The bonus is restored after the count *** Score Event Subroutines *** ' Just copy and paste for these scoring features GetSpecial() ' Add a credit. Change if you want more than 15 ' Calls CreditText() to display the new credit total ' Calls savehs() to save the special to the file GetExtraBall ' Add a Extra Ball AttractLights ' Set the lights to blinking for attract mode ' This is where you add lights ' A separate more advanced tutorial is included in ' the tutorials folder written by Chris Match() ' Main Routine to the end of game match and high score check ' Uses MatchTimer_Timer() to start the match feature at the end of the game. ' Calls the Match2() routine to display the match ' and restarts the Attract mode *** Adding Text during game *** credittxt.text="ShivaEngine" ' To add a credit text credittxt.text="" ' Clears text *** QuickBall Timer *** QuickBall = True ' To start the quickball (or BallSaver) feature QuickBall = False ' Turns off quickball ' To change the amount of time, go to the table editor, and find the Timer ' (named QuickBallTimer) and change the value from 20000 (or 20 seconds) to whatever you like. (1000=1 second) ' Look in the Drain_Hit() Sub for the routine controling this *** Create a ball at the plunger *** Trough.CreateBall.Image = "ballimage7" ' creat a new ball at the trough kicker, and add the ball image Trough.kick 60, 4 ' Kick out the ball from Trough Kicker FlashTimer.Interval = 500 ' Update player display FlashTimer.Enabled = True =============================== Table Example Subroutines calls =============================== ' These are used by the table itself *** Ramps *** ' Ramp Loop bonus is switched on by LeftInlane_Hit and RightInLane_Hit Triggers ' Bonus is collected by RampLoopRight_Hit and RampLoopLeft_Hit Triggers RampDropGate.IsDropped = False ' Target RampDropGate up ' (Controlled by TriggerUp_Hit in table example) RampDropGate.IsDropped = True ' Target RampDropGate down ' (Controlled by TriggerDown_Hit in table example) TLeftTimer.Enabled = True ' Turns on a timer for RampLoop (red ramp in table example) ' Routine switchs off timer, to change, look for TLeftTimer Timer ' Icon in the table editor (left of the table) TRightTimer.Enabled = True ' Turns on a timer for RampLoop (Green ramp in table example) ' Routine switchs off timer, to change, look for TRightTimer Timer ' Icon in the table editor (left of the table) *** 1-2-3-4-5 Rollovers *** ' These are simple calls, in the table example, they are also used with lights LightRollover(X) ' Calls Rollover Control Sub to control each rollover ' Since there are 5 rollovers, replace "X" with a number from 1 to 5 ' In the table example, these are controlled by triggers named ' LeftInlane_Hit() : RightInlane_Hit() : Trig1_Hit() : ' Trig2_Hit() : Trig3_Hit() ' Look for the LightRollover(ByVal Lane) Sub in the ' RESET AND CHECKING SECTION ' If all 5 Rollovers, then it calls LightTrigScore() LightTrigScore() ' if all 5 Rollovers, then this calls the TAdvMult() multiplier ' and resets lights and starts over *** Targets *** ' 3 inline targets, TargetA to C. TargetABCCheck() ' Check if all targets have been hit, if yes, all 3 targets "down ' This routine then calls TargetsABCTimer_Timer() which controls ' adding the bonus score, and then calls the routine ' to reset the targets back to their up position *** Gate *** ' This actually controls the routines for turning off the quickball value if the BallSaver feature has been triggered ' Here's the sample code: If QuickBall_replay = False And Drained = True Then Drained = False ' To show this is a NEW ball, not a mulitball or QB replay ball QuickBallTimer.Interval = 20000 ' Ensures timer gives 20 seconds QuickBallTimer.Enabled = True QBLight.State = 2 ' indicate within 20 second QuickBall time, but not on a QB replay - only 1 QB per ball End If ' This also contains the code to prevent a new game being started accidently during a game already in play ' Started = True =========================== Hit Events =========================== ' List of all the special table object hit events used for the table example TriggerUp_Hit ' RampDropGate Wall is up TriggerDown_Hit ' RampDropGate Wall is down LeftInlane_Hit() ' Left Inside Flipper lane, controls RampLoop, rollover(4) RightInlane_Hit() ' Right Inside Flipper Lane, controls RampLoop, rollover(5) Trig1_Hit() ' Top 3 lane rollover, controls rollover(1) Trig2_Hit() ' Top 3 lane rollover, controls rollover(2) Trig3_Hit() ' Top 3 lane rollover, controls rollover(3) LightRollover(ByVal Lane) ' 1-2-3-4-5 Rollover Control routine LightTrigScore() ' 1-2-3-4-5 Made Control routine ShiftLanesLeft() ' Move 1-2-3-4-5 lights with flipper press ShiftLanesRight() ' Move 1-2-3-4-5 lights with flipper press lanelitesout() ' Turn off 1-2-3-4-5 lights routine RampLoopRight_Hit ' On Green Ramp, for collecting Loop Bonus RampLoopLeft_Hit ' On Red Ramp, for collecting Loop Bonus LeftOutlane_Hit() ' Left Drain lane RightOutlane_Hit() ' Right Drain lane LaunchTrigger_Hit() ' Plays sound at plunger TriggerBonus_Hit() ' Scores a bonus, on left lane to the top Bumper1_Hit() ' Code for Pop Bumper Bumper2_Hit() ' Code for Pop Bumper Bumper3_Hit() ' Code for Pop Bumper LeftSlingshot_Slingshot() ' Left Slingshot RightSlingshot_Slingshot() ' Right Slingshot BTarget1_Hit() ' Non dropping wall left side, hit twice and after during ball in play ' awards a bonus BTarget2_Hit() ' Non dropping wall middle of the table, hit twice and after during ball in play ' awards a bonus TargetA_Hit() ' Inline target right side TargetB_Hit() TargetC_Hit() Sub TargetABCCheck() ' Check ABC Targets TargetsABCTimer_Timer() ' Timer Delay for ABC Targets ResetTargets() ' Reset the drop ABC targets Spinner1_Spin() ' Spinners do not have a Hit routine, they have a Spin routine instead Gate_Hit() ' Code for QuickBall, and prevents starting a new game during the ball in play. Kicker1_Hit() ' Top Right kicker, scores points and a special Kicker1_Timer() ' Timer delay for Kicker1 ResetKicker() ' Resets the Kicker1 values back to the begining KickerLock1_Hit() ' For first Multiball KickerLock1_Timer() ' Timer delay for KickerLock1 Kicker2_Hit() ' This is the kicker on the Blue ramp, that kicks the ball out in Multiball Kicker2_Timer() ' Timer delay for Kicker2 KickerLock2_Hit() ' Second Lock Ball kicker, and releases both balls for Multiball KickerLock2_Timer() ' Timer delay for KickerLock2 Lock1() ' For KickerLock1 multiball. Creates a new ball at Kicker2 BonusCollectKicker_Hit() ' This collects bonus when made BonusCollectKickerTimer_Timer() ' Timer delay for BonusCollectKicker =============== Other Routines =============== ' subroutines used in engine, usually called by other subroutines LightHS.state = 0 ' Turn Off High Score Light (On First Ball) LightTilt.state = 0 ' Turn off the tilt light CreditText() ' Update the credit display BallText() ' Update the ball in play display updatedisp ' Highscore display update BonusCollectClose() ' Closes Bonus Collect ResetBonus() ' This resets the Bonus lights for the start of each new ball in play ' Multiplier lights turned off when TAdvMultCount() called ' at BonusTimer_Timer() sub AddBonusLights() ' Bonus Light routine, for light control during Bonus Countdown ' Called by AddBonus Sub CheckMulti() ' This routine checks for the multiplier, and calls the TAdvMultCount to ' count by each mult value Sub TAdvMultCount() ' The main control routine that counts each bonus by the mult value BonusTimer2_Timer() ' Straight bonus Countdown, used by BonusCollectKicker Match() ' Do the end of game match and high score check MatchTimer_Timer() ' Generates and displays the match number Sub Match2() ' Finish the match routine and go into attract mode TimerAttract_Timer() ' This will alternate between displaying the player's score for 5 seconds ' and the high score for 1 second TimerTilt_Timer() ' This takes care of slowing down and stopping the tilt bob TiltCheck() ' This adds to the swing of the tilt bob and checks to see if we tilted savehs ' saves your High Score to a text file loadhs ' This loads your High Score to be used by the Attract Mode FormatLightString(ByVal State) ' Routine for Light values by numbers instead of "off""on""blinking" ================= Table Timers ================= ' Lists the timers used in the game that are adjustable from the table editor ' Adjust the interval settings as you like ' These timers are on the LEFT side of the table TargetsABCTimer ' Interval 2500 (2 1/2 seconds) Amount of time for Targets to reset TRightTimer ' Interval 10000 (Ten Seconds)(amount of time LoopBonus is on) TLeftTimer ' Interval 10000 (Ten Seconds)(amount of time LoopBonus is on) QuickBallTimer ' Interval 20000 (20 Seconds) (amount of time for Ball Saver) credtimer ' Interval 1500 (1 1/2 seconds) Timer used for text box display BonusCollectKicker ' Interval 500 (1/2 second) Timer delay for kicker ' No need to adjust these timers ' These timers are on the RIGHT side of the table FlashTimer ' Interval 500 (1/2 second) Update player display TimerAttract ' Interval 1000 (One Second) Turn on attract mode BonusTimer ' Interval 100 (1/10 second) BonusTimer2 ' Interval 100 (1/10 second) TimerTilt ' Interval 1000 (one second) MatchTimer ' Interval 100 (1/10 second)