Thursday Discount - Lifetime Access for $20!!!! - Click Here!

Table Settings in the Pinball Games iOS and tvOS Starter Kit

Table Settings in the Pinball Games iOS and tvOS Starter Kit

Every table dictionary define it’s own settings. Unfold the kit’s demo Table1 dictionary, you’ll find the TableSettings dictionary, like so…

Table Settings in the Pinball Games iOS and tvOS Starter Kit

The most important setting in here (and only one really required) is SKSBaseName, which defines what Scene (.sks) file to load. In the example above, the base name is Table1, which means the kit will look for either Table1Phone, Table1Pad, or Table1TV depending on which device the app is currently running on.

Loading SKS files in Xcode with Sprite Kit

So when you create your own table, let’s suppose you give the SKSBaseName a value of UnderwaterTable. This would mean your project should have three Scene (.sks) files named…

  1. UnderwaterTablePad
  2. UnderwaterTablePhone
  3. UnderwaterTableTV

Make sense? No. You can watch this Initial Scene Setup video for more info if need be.

The rest of the properties in the TableSettings dictionary are optional. Deleting them will just make the table use default values for each of the properties. But what fun would that be to talk about, so let’s discuss each. In order of usefulness….

  • BallsToStart – (default is 5) A Number value for the number of balls to begin with. Be sure the Type is set to Number (not String).
  • BallLostBelow – (default is -50) This is a Number value for the y axis point at which the ball is considered “lost” or in the drain, so to speak. So as long as the ball is greater than this value, it is still in play. Once below this number, the player has lost that ball.
  • SaveBallIfOffTable – If YES, the kit will not subtract a ball from the players ball count (number of balls left) if the ball goes below the previous property’s value on the y axis. But is less than 0 or greater than the location of the plunger. Basically that means the ball went offscreen and “off the table”. A nice piece of glass prevents this from happening in real pinball tables, but all bets are off in the fast paced world of Sprite Kit. An incoming email can make Sprite Kit skip a beat, and the ball slips off the table. This is rare, but we’ve seen it. And nothing’s worse than getting charged a ball for no reason.
  • SimplePlungerLaunch – (default is NO). Setting this to YES disables pulling down on the plunger to launch the ball. If your pinball game is meant for toddler-aged kids, this is actually a good option as it keeps them from having trouble launching the ball.
  • TurnOffDefaultDrain – (default is NO). Setting this to YES will disable losing balls below -50 (or whatever the value of the property BallLostBelow is). Most likely, you will want to leave this at NO (or delete it).
  • GravityY -(default is -9.8) A Number value for the gravity pull on the y axis. -9.8 is the default for all Sprite Kit scenes. A non-negative number would make the ball fall upward.
  • GravityX – (default is 0.1) A number value for the gravity pull on the x axis. Or in pinball terms, it’s basically the tilt of the table. 0.0 is unrealistic, so the default is the relatively small number of 0.1
  • GameOverTime – (default is 4) A number value for the number of seconds to wait before starting a new game after all balls are lost.
  • ReplayTableIfScoreUnder – (default is 0, which for this property means it is ignored). If this value is set to a positive non-zero Number, the kit will determine whether the player will move onto the “next” table, or fail and have to replay the current table or a specific “fail” table. If you choose to set a specific fail table, essentially, the player is going back a table. In this sense, you could progress the player back and forth through a series of tables.
  • NextTable – If the previous property is used, this is the name of the table dictionary in the property list (not an SKS file name) to advance to if the player  exceeds a particular score. If excluded, the table would reload itself (essentially negating the previous property). So most likely if you set ReplayTableIfScoreUnder, you will want to use this property.
  • FailTable – Just like the property above, but defines the table dictionary to go to if the player doesn’t exceed the ReplayTableIfScoreUnder value. If excluded the current table is reloaded. Probably a good idea to exclude this, but you could really cheese off players by making them go back an entire table.
  • LCDAlpha – (default is 1, or 100%) A number value for the alpha of any sprite* in the scene named “LCDScreen”. This is just a convenience property to tinker with an overlay on top of your labels for the score or ball count. Xcode doesn’t provide an Alpha value in the Scene editor. Hint hint, Apple?
  • HideRailPaths – (default is NO) Setting this to YES will automatically hide any RailPath class node in the scene. If your rail path is an image with the bare minimum amount of alpha (10%) to allow using an Alpha Mask physics body, setting this to YES will hide the rail path the rest of the way. This has no effect on it’s physics body, so it functions as expected.
  • HideDummyObjects – (default is NO). This will hide any Color Sprite in the scene that does not have a texture. You might use sprites with just a color (or color with the alpha turned down to 0) to use as invisible barriers on the table. You might want to do this to guide the ball, or make it seem like it has collided with something that doesn’t actually have a physics body. Setting this to YES, will also make each of these objects go to a low zPosition when it hides them.
  • SlideInformationLabels – (default is YES) which slides in the “informational” labels, when they are revealed. These labels include those named: ReadyLabel, InstructionLabel, InstructionLabel2, GameOverLabel, GameOverLabel2. The labels will each slide to x:0 , and assuming they are children of the Camera, this places them in the middle of the screen. Setting this to YES a smoother transition, and also allows you to push those labels off to the side when laying out your table in the Scene Editor.
  • BallLostGoals – (default is none) If this value is set to String or an Array (of Strings), the listed goals will be added to every time the ball is lost. Each string value should match a dictionary of the same name in the Goals dictionary. Incrementing a goal value can trigger other events in the game (lights turning on, extra balls, etc). Using this property you could award the player an extra ball every time they lost 4 balls. Thus making it seem like they got an extra ball right at the end. Yes, a cheap thrill.
  • HighScoreGoals – (default is none) If this value is set to String or an Array (of Strings), the listed goals will be added to every time a new high score is achieved. This can only occur once per game though.

*technically speaking an SKSpriteNode (Color Sprite in the Object library)

Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!