Tap and Rotation Controls / Events
You can add a TapControls or TapControlsSecondary dictionary to your page to set up two different tap gestures. Tap gestures are like touches, but you can specify how many fingers should be touching the screen at once using the Touches property, as well as the number of quick sequential taps are required to trigger the gesture, using the Taps property. So you could move a node(s) or simply run an Events dictionary.
As the name implies, TapControls is potentially very useful for controlling a character in the scene. The tap location will be detected in relation to the first (or only) item defined by the Move property. So if the tap location is more above Balloon2 then it is left or right, then the Up value will be used and the Move items will go in that direction using the Speed value for the amount of time the move will occur over. In the example screenshot above, it would only be 1 second. The Easing property determines the easing of the movement animation. Values are Linear, EaseInOut, EaseIn or EaseOut.
You can also use the ParallaxMove array with the ParallaxMultiplier to move items in relation to the main movement.
If you want a secondary tap gesture (with different Taps and Touches parameters) create an entirely new dictionary called TapControlsSecondary.
You can add a RotationControls and RotationControlsSecondary dictionary to your page, to make nodes respond to the user performing a rotation gesture on the screen.
The Rotate array inside the dictionary lists any nodes you want to rotate. All nodes sharing the same name would be rotated.
The Multiplier property is set to 1 so the amount of finger rotation is a direct 1 to 1 ratio for the node’s rotation. Note this could be any decimal value and -1 would make a direct inverse rotation.
You can also include an Events dictionary to run events when the rotation occurs. The Events dictionary is optional though.
“Pro user” Note: The Events dictionary for the RotationControls runs when rotating begins, whereas the Events dictionary for the RotationControlsSecondary runs when rotating ends. This could be a useful note for playing sounds either before or after the rotation occurs.
If you stumbled onto this article, it is part of our documentation for the Story Tellers iOS Starter Kit 2. The kit enables you to make children’s book apps and games without writing any code! But it is Swift 2 based and compatible with iOS9 (or higher) and Xcode 7 (or higher), so kit buyers can even extend the functionality to fit their needs further. Some of what we cover in the kit documentation may apply to Xcode in general, so this article could be worth a read even if you aren’t a user. You can purchase Lifetime Updates the kit here, or subscribe Yearly to CartoonSmart and get the latest version, plus access to all of our other kits / tutorials.
We’ve also created an iBook to document the very latest properties in the kit, so be sure to download that as well.