Label Settings in the Pinball Games iOS and tvOS Starter Kit

Labels in the Pinball Games iOS and tvOS Starter Kit

Labels are an important part of letting your user know what’s going on at a particular time. No kidding, right? Okay, we all know how important common user interface elements are like, the score, or the number of lives left (in this case balls). As we developed the Pinball Games Starter Kit, we realized adding plenty of label options is especially important for two reasons.

First,  pinball games often tell you the “rules” of the table while playing. Bump up against something, and the table might tell you that a multiplier is in effect. Or that you should bump up against that same thing 3 more times to activate something else.  Second, labels are also an important design aspect. You’ll discover, as we did, there are times when you stylistically want a particular label to feel as if its part of the table itself. And other times, you might find it is best to make that label a child of the camera, so whenever the camera moves, the label moves with it (thus visually staying in one place). And thank the Sprite Kit Gods, that zooming the camera, has no scale effect on it’s children. So you can zoom in or out during multi ball modes, without affecting your labels. To get an idea of how it looks in the Scene Editor when a label (or other object) is a child of the camera see the image below…

Camera_GUI-2

To make a label, or anything for that matter, a child of the TheCamera, find the label’s Parent setting in the Attributes window.  See the image below for reference…

Sknode child of parent

In the example above, you can see the Parent setting is circled, and TheCamera is selected. The dropdown toggle will list every node in the scene.


 

You can also include multiple labels with the same name. These names are important, as the engine is hard coded to look for matches of a specific name, then change the text accordingly. By allowing you to include multiple label nodes with the same name, this means you could parent one to the camera, and let another seem like it is part of the table. You’ll notice the LCD display screen below is duplicated. This is because on the tvOS app, the user can’t see the entire LCD display when the ball is on the top or bottom of the table. So the best solution to keep the player informed was to update a separate non-moving display on the left. Lights and table objects can also share the same name, and work accordingly.

Labels in the Pinball Games iOS and tvOS Starter Kit

 

Screen Shot 2016-02-25 at 2.44.50 AM

Properties in the Labels dictionary

There’s quite a few options here, so lets dive in. Note though, all of these can just be left as their default values (excluded altogether). We will note in each property which label in the Scene this message would appear in. Many of values below are used in AchievementLabel and AchievementLabel2 (basically line 1 and a possible line 2 of text) which are dedicated to giving the user most of the information in the game. TableObjects, Lights, and Goals can also set text for AchievementLabel and AchievementLabel2. So these two labels are like your game’s main hub of information.

  • WelcomeMessage – Text for the AchievementLabel when a new game begins
  • WelcomeMessage2 – Text for the AchievementLabel2 when a new game begins
  • BallLostMessage – Text for the AchievementLabel when the ball is lost
  • BallLostMessage2 – Text for the AchievementLabel2 when the ball is lost
  • TogglePlayer1Message – Text for the AchievementLabel when it is Player 1’s turn again.
  • TogglePlayer1Message2 – Text for the AchievementLabel2 when it is Player 1’s turn again.
  • TogglePlayer2Message  Text for the AchievementLabel when it is Player 2’s turn again.
  • TogglePlayer2Message2 –  Text for the AchievementLabel2 when it is Player 2’s turn again
  • PlungeMessage – Text for the AchievementLabel when the plunger is released.
  • PlungeMessage2 – Text for the AchievementLabel2 when the plunger is released.
  • AchievementGameOverMessage – Text for the AchievementLabel when the game is over
  • AchievementGameOverMessage2 – Text for the AchievementLabel2 when the game is over
  • GameOverMessage – Text for the GameOverLabel when the game is over.
  • GameOverPlayer1WonMessage – Text for the GameOverLabel2 when the game is over and Player 1 has won. (ignored in one player games)
  • GameOverPlayer2WonMessage  – Text for the GameOverLabel2 when the game is over and Player 2 has won. (ignored in one player games)
  • InstructionsTV  – (used on tvOS apps only)  Text for the InstructionsLabel when a new game has begun.
  • InstructionsTV2 – (used on tvOS apps only) Text for the InstructionsLabel2 when a new game has begun.
  • InstructionsPhone – (used on iPhone apps only)  Text for the InstructionsLabel when a new game has begun.
  • InstructionsPhone2 – (used on iPhone apps only) Text for the InstructionsLabel2 when a new game has begun.
  • InstructionsPad – (used on iPad apps only)  Text for the InstructionsLabel when a new game has begun.
  • InstructionsPad2 – (used on iPad apps only) Text for the InstructionsLabel2 when a new game has begun.
  • PlayerLabelPrefix – Prefix text for the PlayerLabel. For example, if you enter “PLAYER” here. The label will read “PLAYER 1” when it is player 1’s turn, and “PLAYER 2” when it is player 2’s turn.
  • PlayerLabelPostfix – Postfix text for the PlayerLabel. For example, if you enter “YOUR TURN” here (and use the previous label). The label will read “PLAYER 1 YOUR TURN” when it is player 1’s turn, and “PLAYER 2 YOUR TURN” when it is player 2’s turn.
  • ScoreLabelPrefix1 – Prefix text for the ScoreLabel1. This is a label dedicated only to showing player 1’s score. This text will appear before the score. For example, this might be “Score for Player 1: “
  • ScoreLabelPostfix1 – Postfix text for the ScoreLabel1. This is a label dedicated only to showing player 1’s score. This text will appear after the score. For example, ” Points”
  • ScoreLabelPrefix2 – Prefix text for the ScoreLabel2. This is a label dedicated only to showing player 2’s score. This text will appear before the score. For example, this might be “Score for Player 2: “
  • ScoreLabelPostfix2 – Postfix text for the ScoreLabel2. This is a label dedicated only to showing player 2’s score. This text will appear after the score. For example, ” Points”
  • HighScorePrefix – Prefix text to appear before the HighScoreLabel, which displays the app’s highest score to date. This will probably be something like “High Score: “
  • BallLabelPrefix1 – Prefix text for the BallLabel1. This is a label dedicated only to showing player 1’s current number of balls remaining. This text will appear before the number. For example, this might be “Balls: ” , so at runtime the label reads “Balls: 5”.
  • BallLabelPostfix1 – Postfix text for the BallLabel1. This is a label dedicated only to showing player 1’s current number of balls remaining. This text will appear after the number. For example, this might be ” Remain”, so at runtime the label reads “5 Remain”
  • BallLabelPrefix2 – Prefix text for the BallLabel2. This is a label dedicated only to showing player 2’s current number of balls remaining. This text will appear before the number.
  • BallLabelPostfix2 – Postfix text for the BallLabel2. This is a label dedicated only to showing player 2’s current number of balls remaining. This text will appear after the number.
  • MinimumScoreDigits – The minimum number of digits to format a label named ScoreLabel. If you enter 10 here, and the score is a pathetic 5 points. The formatted score would be “0000000005” . Nine leading zero’s would be added to the single digit score, for ten digits total.  Note this label is not dedicated to a particular player. So the score will always reflect who is currently playing. This option is mostly intended for ScoreLabels that will appear like authentic pinball table scores (LCD style).
  • FormatDedicatedScores – (default is NO) Setting a YES value will also format ScoreLabel1 and ScoreLabel2 (the dedicated scores labels for each player) with the previous property’s minimum number of digits.
  • FormatHighScore – (default is NO). Setting a YES value will also format the HighScoreLabel.
  • ReadyMessagePlayer1 – Text for the ReadyLabel when it is Player 1’s turn again.
  • ReadyMessagePlayer2 – Text for the ReadyLabel when it is Player 2’s turn again.
  • ShowLabelsForCurrentPlayerOnlyTV – (tvOS apps only, the default is YES) For any label that is dedicated to a particular player, like ScoreLabel1, BallLabel1, ScoreLabel2, BallLabel2, these are normally hidden when it is not that player’s turn. Setting this to NO will make it so these labels are always seen. Depending on the available screen space of the device, you might want to change this value accordingly.
  • ShowLabelsForCurrentPlayerOnlyPad  – (iPad apps only, the default is YES) For any label that is dedicated to a particular player, like ScoreLabel1, BallLabel1, ScoreLabel2, BallLabel2, these are normally hidden when it is not that player’s turn. Setting this to NO will make it so these labels are always seen. Depending on the available screen space of the device, you might want to change this value accordingly.
  • ShowLabelsForCurrentPlayerOnlyPhone – (iPhone apps only, the default is YES) For any label that is dedicated to a particular player, like ScoreLabel1, BallLabel1, ScoreLabel2, BallLabel2, these are normally hidden when it is not that player’s turn. Setting this to NO will make it so these labels are always seen. Depending on the available screen space of the device, you might want to change this value accordingly.