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

Extra Balls in the Pinball Games iOS and tvOS Starter Kit

Extra Balls in the Pinball Games iOS and tvOS Starter Kit

Extra Balls in the Pinball Games ioS and tvoS Starter Kit

The kit supports up to 3 extra balls for a multi-ball mode*. Extra balls, like the main ball, are of the Ball class. The two properties they have can be set in the ExtraBalls dictionary, in a dictionary matching their name. In the example, above you can see that name is ExtraBall.  And in the demo project, you’ll find in the table scene three balls all named ExtraBall. They also have a Custom Class set to Ball.

Extra Balls in the Pinball Games Starter Kit

These balls have two possible properties…

  • Dynamic – setting this to a Boolean value of YES, will make the ball automatically part of the physics simulation, affected by gravity, and treated just like a regular ball. Though if it goes down the drain, it won’t count against the remaining ball count (only the main ball subtracts from the count). Setting this to NO, will make it so the ball is non-dynamic,  basically “frozen” until later.
  • DynamicAfterContact – setting this to a Boolean value of YES will make it so if any other ball contacts it when it is currently not dynamic, it will become dynamic, and start multi-ball mode.  The kit will then pan out the camera if you have a different camera zoom set for multi ball mode.  If your extra balls are arranged like those in the image above, a collision with the top ball, would have a cascade effect, triggering the next ball to become dynamic, then the next, unlocking all three. This is one way to trigger multi-ball mode.

Your extra balls could set Dynamic to NO and DynamicAfterContact to NO, and use a Goal to enable multi ball mode. The MakeDynamic property, defined here, could also be used to make every ball dynamic at once (and turn on multi-ball mode).


*Okay, that’s not actually true, you could add a lot more. Code-wise though any extra ball after 3 has the same physics contact parameters as the 3rd ball.  Which only makes a difference if your game has a lot of ramps. The worst thing that could happen would be some odd behaviors with the duplicate 3rd balls, where they would bump against a ramp rail if a 3rd extra ball was already on a ramp. 

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!