StoryTeller’s Kit Notes

Notes about StoryTeller’s Kit v2 from CartoonSmart.

Goals and Disclaimer

The purpose of this file is to:

  • organize info I’ve learned using the kit

  • create task-based documentation for personal use

  • associate reference information with procedures

  • document best practices

This information is intended solely for my personal use. If you are a CartoonSmart customer, please disregard this file and refer to official product documentation instead.

Projects

New Project Setup

Follow these procedures to setup a new project.

Download the kit

  1. Navigate to Cartoonsmart.

  2. Login using subscriber credentials.

  3. Navigate to the documentation page.

  4. Click Download it here.

  5. Select a version of the kit that matches the version of Xcode you use.

    The kit is updated for new releases of Xcode. If you update Xcode, chances are you’ll need a new version of the kit too. Otherwise you may encounter compile errors. The download page links to instructions for converting an older project. Click the link titled Read our General Upgrade Tips right here.

Duplicate the CleanCopy folder

New projects are based on the CleanCopy folder in the StoryTeller’s kit download. To get started, copy the CleanCopy folder. Then paste it wherever you want your project code to be. The CleanCopy folder contains an empty (clean) project to base new projects on.

  1. Look in your Downloads directory for a folder named StoryTellersKit2_Latest.zip

  2. Unzip that file. StoryTellersKit2_Latest.zip contains 2 folders:

    • StoryTellersKit2_version 1.14 (Swift 3)

    • StoryTellersKitTV_version1.2 (Swift3)

  3. Expand the StoryTellersKit2_Latest folder.

  4. Expand the StoryTellersKit2_version1.16 (Swift 3) folder. It contains 2 folders:

    CleanCopy

    Minimal files you need to base a new project on.

    StoryTellersKit2

    Demo version of the kit, containing sample scenes and resources.

  5. Right-click the CleanCopy folder. Select Copy.

  6. Navigate to the destination drive and folder of your choice.

  7. Paste the CleanCopy folder.

  8. Rename CleanCopy to something that identifies your new project.

    Do not rename items inside your project folder. For example, if you rename StoryTellersKit2.xcodeproj to something else, the kit may not work.

Create a Workfiles folder

Optionally create a Workfiles folder to store projects associated with this kit project. For example, you may export images from an Illustrator project, or use a sound editor to clean up raw recordings. Whatever your work files are, you can keep them here.

Make Workfiles a sibling folder of CleanCopy, whatever you called it.

+ image::image011.png[]

Configure project settings

  1. Start Xcode.

  2. Navigate to your clean copy of the storyteller’s kit.

  3. Open StoryTellersKit2.xcodeproj in XCode.

  4. Click OK when asked whether to open a project downloaded from the Internet.

  5. Click StoryTellersKit2 in the left pane. General project properties appear.

Identity settings
  1. Change Display Name to the name of your application.

Signing settings
  1. Change Bundle Identifier to the name of your website, but in reverse order. If you site is mysite.com, you would type com.mysite.

  2. Use the Team box to select your personal team name.

Deployment Info

Deployment settings scope the app to specific devices, or make it universal. . Use the Devices drop box to select iPad. . Check Device Orientation boxes as needed. The app is restricted to landscape orientations by default. That is usually what you want. .Optionally identify the icon you want to use for this application. To change that later, refer to Set the application icon.

Set the application icon

To set the icon that appears on the desktop:

  1. Click the folder icon to show the project navigator.

    image010
  2. In the App icons and launch images section, click the arrow next to the *App Icons Source box.

  3. The AppIcon page appears, prompting you to drag images. These images must match specific pixel sizes for different devices. See https://developer.apple.com/library/content/qa/qa1686/_index.html for details. Here’s a snip from that page, showing icon sizes for iPad-only applications:

    Items marked with "Required" must be included.
    Table 1. iPad-only application icon requirements.

    Image Size (px)

    File Name

    Used For

    App Store

    Ad Hoc

    512x512

    iTunesArtwork

    Ad Hoc iTunes

    Do not include

    Optional but recommended

    1024x1024

    iTunesArtwork@2x

    Ad Hoc iTunes on devices with retina display

    Do not include

    Optional but recommended

    76x76

    Icon-76.png

    Home screen on iPad

    Required

    Required

    152x152

    Icon-76@2x.png

    Home screen on iPad with retina display

    Optional but recommended

    Optional but recommended

    167x167

    Icon-83.5@2x.png

    Home screen on iPad Pro

    Optional but recommended

    Optional but recommended

    40x40

    Icon-Small-40.png

    Spotlight

    Optional but recommended

    Optional but recommended

    80x80

    Icon-Small-40@2x.png

    Spotlight on devices with retina display

    Optional but recommended

    Optional but recommended

    29x29

    Icon-Small.png

    Settings

    Recommended if you have a Settings bundle, otherwise optional but recommended

    Recommended if you have a Settings bundle, otherwise optional but recommended

    58x58

    Icon-Small@2x.png

    Settings on devices with retina display

    Recommended if you have a Settings bundle, otherwise optional but recommended

    Recommended if you have a Settings bundle, otherwise optional but recommended

  4. Drag and drop images into the iPad Settings slots.

    • 1x is for 72-dpi images.

    • 2x is for 144-dpi images.

    • 3x is for 216-dip images

If you image is 72 dpi, drag it to the 1x slot. The 2x slot is for 144 dpi images, and so on. . When you are finished, your screen should look similar to:

image012

Change the launch image

To set the image that appears briefly when the application starts:

  1. Prepare your own startup image in png format. It can be any size that will fit on the screen of the target device. As a rule of thumb, it should be roughly 500 pixels wide at 144 dpi. The default CartoonSmart image is 500 x 309 pixels at 72dpi.

  2. Name the image whatever you like.

  3. Click the folder icon to show the project navigator.

    image010
  4. Select ImageAtLaunch in the Assets.xcassets list.

    image020
  5. Open Finder and locate your new image.

  6. Drag and drop your image to replace the CartoonSmart image in the center slot.

    image021
  7. Next, expand the LaunchScreen folder. Click LaunchScreen.storyboard. You will be prompted to select the device size your are targeting.

    image022
  8. If necessary, drag the image to position it appropriately for the screen of the target device.

  9. Save and compile the app. The startup image should be your own.

Pages

Scenes are pages

Page and Scene are interchangeable terms. Every scene is a SpriteKit scene file. Scene files have a .scn extension. Technically, "scene" makes more sense than "page". Since CartoonSmart documentation refers to pages, I use that term too. It makes sense to think about pages when constructing a book.

New Pages

Add a scene file

To add a page, simply add a SpriteKit scene file to the project.

  1. In Xcode, select File  New  File.

  2. The iOS tab is selected by default. Under Resources, select SpriteKit Scene.

  3. Click Next.

  4. Give the scene an appropriate name.

  5. Click Create to save it in the StoryTellersKit2 folder.

  6. In the tree, drag the scene file to the Scenes folder.

  7. Optionally create a corresponding phone-sided Scene at this time. If you do, name that MyScenePhone, replacing MyScene with the name of the iPad-sized scene. Set its scene size to 736w by 414h.

Size page for a specific device

When a scene file is added, its default size is 750w by 1334h. The Attributes inspector allows you to set device size in width and height, but it is more convenient to use the Size dropdown instead.

  1. Select the scene to load it.

  2. Select the Attributes inspector.

    image039
  3. Select a device from the Size drop list.

    I don’t use the device selector. I use a custom device size that matches the 12.9 inch iPad Pro (2732 x 2048). Due to aspect ratio differences, the top and bottom edges are clipped on phones, but this works best across all devices. This practice eliminates the need to use multiple cameras. The caveat is, if you are developing a universal app for phones, you must design pages knowing that they will be clipped top and bottom by phones when devices differ from 16:9 aspect ratio. All iPads show the full image.

    To set a custom device size for MIM projects: .. Set Size to Custom. .. Set Width to 2732. .. Set Height to 2048. .. Set Anchor Point x to 0. .. Set Anchor Point y to 0.

    + image040

  4. Select portrait or landscape orientation.

How to fix Portrait orientation

When Portrait orientation is selected, the display remains in landscape mode, at least in the simulator. To correct this, it is necessary to change 1 line of code.

  1. In Project Navigator, expand the StoryTellersKit2 folder.

  2. Expand the Misc folder.

  3. Select AppDelegate.swift. Code will load in the editor.

  4. Locate the line that reads:

    return UIInterfaceOrientationMask.landscape // change to .Portrait or .All if needed
    image041
  5. Change this statement to:

    return UIInterfaceOrientationMask.portrait // change to .Portrait or .All if needed
Screen sizes and display resolutions

Information reproduced from Apple Comparison Chart:

image013
Table 2. iPad Screen Sizes
Device Screen Size Screen Resolution Pixel Density

iPad Pro

12.9 inches

2732 x 2048

264 ppi

iPad Pro

9.7 inches

2048 x 1536

264 ppi

iPad Air 2

9.7 inches

2048 x 1536

264 ppi

iPad Mini 4

7.9 inches

2048 x 1536

326 ppi

iPad Air

9.7 inches

2048 x 1536

264 ppi

iPad Mini w Retina

7.9 inches

2048 x 1536

326 ppi

iPad w Retina

9.7 inches

2048 x 1536

264 ppi

iPad Mini

7.9 inches

1024 x 768

163 ppi

iPad 3

9.7 inches

2048 x 1536

264 ppi

iPad 2

9.7 inches

1024 x 768

132 ppi

iPad

9.7 inches

1024 x 768

132 ppi

Manually size for iPad Landscape mode
  1. Click the Attributes inspector.

    image001
  2. Select iPad 9.7" from the Size dropdown. Or manually set Width to 1024 and Height to 768.

Manually size for iPhone

Change the Size setting to 736w and 414h. Or select a phone model.

Articles about Apple displays

Making a universal app?

iPhones and iPads have different screen sizes. There are two ways to develop a "universal" app that works on either family of device:

Method 1: Create 2 scenes for every page

You can create 2 scenes for every page; one sized for iPad and the other sized for iPhone. This approach requires you to duplicate the appearance and functionality across pages.

  1. Create the scene for iPad first. See Size page for a specific device. Cartoonsmart documentation recommends:

    "Your Scene for the iPhone should have a Size setting of 736 and 414. The default is usually 1024 by 768 for the iPad. Be sure to set your iPhone Scene settings to 736 and 414, which matches the screen resolution of the iPhone 6 Plus. Not a Plus user? Not to worry, the iPhone 6 and iPhone 5 will still use these dimensions for positioning but scale down uniformly."

  2. Create a second scene for iPhone, having the same name but suffixed with Phone. For example, if you named your iPad scene Page1 then you would name the scene for phones Page1Phone.

  3. Create/recreate sprites, actions, and so on to make both scenes match, while optimizing sprites for the size of each page. This approach requires extra work.

Method 2: Create an iPad-sized scene with 2 cameras, one for iPad and the other for iPhone.

Using cameras, it is easier to make an app universally viewable. The kit will automatically detect device type (phone or tablet). It will display the scene from the perspective of a camera whose scale setting is optimized for each device.

Cartoonsmart recommends that the Scale property of an iPad camera should be 1 for both its X and Y axis. For an iPhone camera, set Scale to .75 for both X and Y axis. (See Add cameras above a scene for procedural details.)

You can name cameras whatever you like. Examples might be CameraPhone and CameraPad. To tell the kit which to use, assign your camera names to InitialCamera and InitialCameraPhone keys in in Root  Pages  YourPageName  Settings.

Cartoonsmart says this about cameras: "Your page can even set a different camera for the iPhone or iPad (and share the same Scene file). The camera can track a specific object and you can even make images or labels stick to the camera (great for interface elements)."

To implement this method see:

Add cameras above a scene

A camera is an object you drag into a scene, like a color sprite.

To add a camera to a scene:

image042
  1. Click the icon to select the Object Library.

  2. Filter the list by typing Camera in the search box.

  3. Drag a Camera node to the scene.

    If you are adding a camera for a universal app, drag the camera to the center of the screen, to position it over crosshairs.
  4. Name the camera iPadCamera, or something similar. Leave the Scale setting at 1 for both the X and Y axis. That is the recommended setting for iPad cameras.

  5. Select the Scene again. Assign your camera to the scene my selecting iPadCamera (or whatever you named it) from the Camera drop list.

    image043
  6. Add a second camera and name it iPhoneCamera.

  7. For iPhoneCamera only, set zoom by changing the Scale property. Cartoonsmart recommends setting Scale to 0.75 for both the x and y of the camera dedicated to a phone.

    If using custom screen sizes for MIM projects, set Scale of the iPhone camera to 1, or don’t use a second camera at all.
    image044
  8. Assign the Name of the camera to the scene’s InitialCamera or InitialCameraPhone property. See Define scene-level settings.

Identify each camera

To identify which camera corresponds to iPhone or iPad, assign camera names to InitialCamera and InitialCameraPhone keys in Root  Pages  YourPageName  Settings.

image045
  1. Click List.plist in Project Navigator.

  2. If a Settings dictionary does not exist for the page, create one. See Define new page in the Pages dictionary.

  3. Set an InitialCamera key to the name of the iPad camera.

  4. Set an InitialCameraPhone key to the name of the iPhone camera.

See Camera settings for information about other camera settings.

Define new page in the Pages dictionary

Add a dictionary for each new page to the property list below Root  Pages. Page settings configure properties of individual pages, such as camera settings, page transition effects, and physics behaviors. Settings in a page-level dictionary affect that page only. Settings don’t carry over from page to page.

image037
It’s easier to copy an existing page dictionary than it is to manually define a new dictionary with child dictionaries.

To create a dictionary for the new page:

  1. Select the Project navigator.

    image033
  2. Select List.plist.

    image034
  3. Expand the Root dictionary.

  4. Expand the Pages dictionary below Root.

  5. Create an entry for the new page by copying and pasting the Cover page entry:

    1. Right-click Cover. Then select Copy from the menu.

      image035
    2. Right-click Cover again. Select Paste from the menu. An entry named Cover - 2 is created.

    3. Double-click Cover - 2 to rename it. Type the name of the scene file without any extension. For example, if you added a scene file named MyScene.sks, you would type MyScene.

      image036
  6. Add settings as needed. (See MyPage > Settings dictionary.) For example, add an InitialCamera setting to identify the name of a camera you’ve added to the scene. Once you set this property, the scene’s view will use this camera.

    image003
  7. Add other settings as needed. For details about properties you can define for a scene, see Section 3 Page Settings (p11 in the pdf).

    image004

Set the Startup page

  1. Open List.plist.

  2. Add an Events dictionary below Cover.

  3. Add an OpenPage event.

  4. It’s parameter is the name of the startup scene. When you run the project, this scene will appear.

    image006

MyPage > Settings dictionary

Add Keys to:

Root > Pages > MyPage > Settings

Each page can have its own Settings dictionary. These settings only affect the current page, and don’t carry over from page to page. The Settings dictionary for a page can contain keys from these categories:

Category Description

Cameras

Define cameras used by different devices to view a scene. For example the camera for an iPhone might view the scene from a higher vantage point to make everything fit on its smaller screen.

Page Transition Effects

Settings to control the animation effect applied when a page transition occurs.

Physics

Settings that affect physics bodies in a scene.

Sound Settings

Sound settings manage audio playback in a scene.

Keyboard Settings

Keyboard settings manage which keyboard appears in a scene.

Text-to-Speech Settings

Text-to-Speech settings manage rate, volume, pitch, and voice, and whether playback of another TTS string should interrupt the current speaker.

Preload or Require Resources

Preload images, animations, and other elements before a page is displayed.

Specialty Settings

Settings that affect miscellaneous behaviors of the kit.

The Settings dictionary only affect the current page. Settings don’t carry over from page to page.

Camera settings

These keys manage camera settings.

Camera Settings
Add Keys to:

Root  Pages  MyPage  Settings

Keys

InitialCamera—name of camera used to view this scene on an iPad.
InitialCameraPhone—name of camera used to view this scene on an iPhone.
CameraFollows—name of node the camera will lock into and follow.
CameraFollowsOnX—name of node camera will follow but only on X axis.
CameraFollowsOnY—name of node camera will follow but only on Y axis.
CameraOffset—offset to adjust camera in relation to the node it is locked on to. Applies to iPad only.
CameraOffsetPhone—adjusts camera position relative to node it is following. Applies to iPhone only.
NodesFollowCamera—string or array of strings that defines which nodes lock on and follow the camera.

Key Permissible Values

InitialCamera

The name of a camera you’ve added to the scene (CamPad for example). Once you set this property the Scene’s “view” will use that camera. This option is important because you can treat the camera much like any other node. Move it around, scale it, make it follow a specific node, switch cameras, etc.

InitialCameraPhone

Like the property above, but only applies to iPhone devices (CamPhone for example). This is an important option because for many pages you could probably use a single Scene file (.sks file) instead of making an entire duplicate for the phone, and simply use a different camera dedicated to the phone.

You can zoom using the Scale property. We suggest setting 0.75 for both the x and y of the camera dedicated to the phone.

CameraFollows

The value will be the node the camera will lock onto and follow. Most likely this will be the name of one of the Element class sprites you’ve added (but this could even be a particle emitter).

CameraFollowsOnX

The value will be the node the camera will lock onto and follow but ONLY on the x axis. This is a good option if your art work is sized in such a way that lowering or raising the camera would reveal the edges

CameraFollowsOnY

The value will be the node the camera will lock onto and follow but ONLY on the y axis.

CameraOffset

An offset value in {x, y} format to adjust the camera in relation to the node it is following.

CameraOffsetPhone

An offset value in {x, y} format to adjust the camera in relation to the node it is following. This value is ignored if the device is an iPad as it only affects the iPhone.

NodesFollowCamera

A String or Array of strings to define which nodes will stay locked onto the camera when it follows another node. Particularly useful for things like a background sky, because once locked into the camera it will appear infinite. In other words, you would not need to make the sky any larger than the camera.

Page Transition effects

Transition keys in a Settings dictionary control the animation effect applied when a page transition occurs.

Transition
Add Keys to:

Root  Pages  MyPage  Settings

Keys

Transition—the animation effect applied.
TransitionTime—duration of the effect.
TransitionDirection--direction of the effect, if applicable
TransitionColor--color used, if applicable.
TransitionDelay--how long to wait before starting the transition.

Key Permissible Values

Transition

The Transition key specifies which animation effect to apply when a page transition occurs. Permissible values are:

CrossFade

A cross fade transition.

DoorsCloseHorizontal

A pair of closing horizontal doors.

DoorsCloseVertical

A pair of closing vertical doors.

DoorsOpenHorizontal

A pair of opening horizontal doors.

DoorsOpenVertical

A pair of opening vertical doors.

DoorWay

The previous scene disappears as a pair of opening doors.

FadeWithColor

Creates a transition that first fades to a constant color and then fades to the new scene.

Fade

Creates a transition that first fades to black and then fades to the new scene.

FlipHorizontal

The two scenes are flipped across a horizontal line running through the center of the view.

FlipVertical

The two scenes are flipped across a vertical line running through the center of the view.

MoveInWithDirection

Creates a transition where the new scene moves in on top of the old scene.

PushWithDirection

Creates a transition where the new scene moves in, pushing the old scene out of the view.

RevealWithDirection

Creates a transition where the old scene moves out of the view, revealing the new scene underneath it.

TransitionTime

Specify the duration for the next page transition as a number value.

TransitionColor

If the transition uses the color property, you can specify that by using a hex value or some generic colors like Red, Orange, Yellow, Green, Blue, Purple, Magenta, Cyan, Brown, Grey (or Gray), Black, White

TransitionDirection

If the transition uses the direction property, you can specify it here using Up, Down, Left or Right

TransitionDelay

The duration to delay the next transition as a number value. This could be useful if you wanted delay a page transition that was prompted via an event. For example, maybe the reader completed a puzzle and you wanted to show the finished result for 5 seconds before going to the next page (this could also be done using the StartTimer option).

Control individual page transitions

Explain here how to override the page transition stored in Root > Elements, by recreating navigation logic (including Transition) at the page-level.

Physics settings

Physics settings affect physics bodies in a scene.

image038
Add Keys to:

Root  Pages  YourPageName  Settings

Keys

HasPhysicsBoundary—sets invisible edge around scene to keep physics bodies inside..
BoundaryWithMultiplier—multiplies the boundary by some amount.
BoundaryWithMultiplierOnX—multiplies boundary but keeps its height the same as the screen height.
BoundaryWithMultiplierOnY—multiplies boundary but keeps its height the same as the screen width.
BoundaryWithMultiplierOnXAndY—non-uniformly multiply both the width and height of the boundary.
BoundaryOffset—offsets boundary by x,y (iPad).
BoundaryOffsetPhone—offsets boundary by x,y (Phone).
ShowPhysics—whether to show the physics bodies around objects.
Gravity—gravity for the scene in {x, y} format.

Key Permissible Values

HasPhysicsBoundary

The simplest way to set a physics boundary around the scene. An edge boundary, can contain physics bodies within it, but they can’t get out. A boundary made with this setting is exactly the value of the initial visible screen area. A boolean, set YES or NO.

BoundaryWithMultiplier

Set a number value to multiply the edge-based boundary around the screen. For example, 2 would double the boundary’s width and height.

BoundaryWithMultiplierOnX

Set a number value to multiply the edge-based boundary around the screen but keep the height the same as the screen height.

BoundaryWithMultiplierOnY

Set a number value to multiply the edge-based boundary around the screen but keep the width the same as the screen width.

BoundaryWithMultiplierOnXAndY

A string value in {x, y} format to non-uniformly multiply both the width and height of the boundary. For example, {2, 4} would double the boundary’s width and quadruple the boundary’s height.

BoundaryOffset

Allows you to offset the boundary using {x, y} format. (probably necessary when using a multiplier)

BoundaryOffsetPhone

Allows you to offset the boundary using {x, y} format. (probably necessary when using a multiplier). Only affects building to the phone

ShowPhysics

Set to YES to the show the physics bodies around objects. Good for debugging (can also be done from the Scene file too)

Gravity

The gravity for the scene in {x, y} format. This can also be set in the Scene’s .sks file.

Sound Settings

Sound settings manage audio playback in a scene.

Add Keys to:

Root  Pages  MyPage  Settings.

Key Permissible Values

BgSoundVolume

Aa decimal value to set the volume. 0.5 is 50%.

BgSoundLoops

By default this is set to -1 which will always loop. Setting 1 would replay it once, 2 twice, and so on.

BgSoundContinueOnNextPage

A YES or NO bool value as to whether to stop the background sound when the page changes. By default it is NO.

NarrationVolume

A decimal value to set the volume. 0.5 is 50%.

NarrationLoops

By default this is set to 0 which will not loop. Setting 1 would replay it once, 2 twice, and so on.

NarrationContinueOnNextPage

A YES or NO Bool value as to whether to stop the sound when the page changes. By default it is NO.

Keyboard Settings

Keyboard settings manage which keyboard appears in a scene.

Add Keys to:

Root  Pages  MyPage  Settings

Key Permissible Values

KeyboardType

If the keyboard will be seen at anytime on the page, you can change the type. Values are Default, ASCIICapable, NumbersAndPunctuation, URL, NumberPad, PhonePad, NamePhonePad, EmailAddress, DecimalPad, Twitter, Websearch

KeyboardAppearance

Light, Dark or Default. The keyboard below is set to Light.

Text-to-Speech Settings

Text-to-Speech settings manage rate, volume, pitch, and voice, and whether playback of another TTS string should interrupt the current speaker.

Add Keys to:

Root  Pages  MyPage  Settings

Key Permissible Values

SpeechRate

A decimal number value, default is 0.38

SpeechVolume

A decimal number value, default is 1.

SpeechPitch

A decimal number value, default is 1.70

SpeechVoice

A voice code or country name for a new voice.

AllowRunOnSpeech

A Boolean value. Set YES and events that call text to speak will not interrupt the current speaking. So for example, calling a Speak event back to back will run the speech one after the other.

Preload/Require Resources

StoryTeller’s Kit allows images, animations, and other elements to be loaded before a page is displayed. This is an On-Demand Resource Setting.

Add Keys to:

Root  Pages  MyPage  Settings

Key Permissible Values

ResourceTags

An array of element names that are required for this page to open.

PreloadResourceTabgs

An array of resources to preload.

By adding an Array named ResourceTags and listing tag names, the Map page now knows that the tagged content is required for this page to open. You can find out more about On-Demand Resources in __.

image047

You can preload content from any page by using the PreloadResourceTags property. Again, this can be an array to list multiple tags, like so…​

image048

So in the example above, we are preloading the MapTag, assuming that the reader is close to opening a page that includes the MapTag content.

Speciality Settings

Settings that affect miscellaneous behaviors of the kit.

Add Keys to:

Root  Pages  MyPage  Settings

Key Permissible Value

DebugMode

Setting a YES value will show developer nodes as print statements in the output window.

ListenerSpeed

A number value for how fast you want listeners in the scene to run. The default is 0.25 or every quarter-second. Raise or lower to your liking. All Listeners fire once immediately, then begin using this speed afterwards. The lowest you should set this value is 0.02, but thats probably overkill.

AnimateNodeToSlotTime

An number value for the time it takes for nodes to animate to a slot. The default value is 1. Only used in conjunction with the AnimateNodeToSlot event. This time value has no effect on anything else.

AnimateNodeToNodeTime

An number value for the time it takes for nodes to animate to a node. The default value is 1. Only used in conjunction with the AnimateNodeToNode event. This time value has no effect on anything else.

AnimateNodeToInventorySlotTime

An number value for the time it takes for nodes to animate to a designated Inventory Slot. The default value is 1. Only used in conjunction with the AnimateNodeToInventorySlot event. This time value has no effect on anything else.

AnimateNodeToPathTime

An number value for the time it takes for nodes to animate to the next designated path point. The default value is 1. Only used in conjunction with the AnimateNodeOnPath event. This time value has no effect on anything else.

FlushSavedValues

A Bool value. Setting YES will clear ALL saved values in the app. CAUTION this will remove all values in the NSUserDefaults, essentially resetting the app, including any saved defaults for purchases. Not recommended if you have in- app purchases, especially Consumables.

PairingSensitivity

A number value (either 0, 1, 2, or 3) to set how sensitive the kit is in detecting puzzle style pairing (only applies if there is an Event Listener for pairing setup). 0 uses the entire width and height of the image, assume puzzle piece, when checking the intersection of the puzzle and base position. 3 only uses a fraction of the width and height making the puzzle pairing more exact.

IntersectionSensitivity

A number value (either 0, 1, 2, or 3) to set how sensitive the kit is in detecting intersections (only applies if there is an Event Listeners setup). 0 uses the entire width and height of the image when checking the intersection of the other element’s position. 3 only uses a fraction of the width and height making the intersection detection more exact.

RemovePhysicsBodyOnPairing

A YES or NO value to remove a physics body on the puzzle piece being paired to a base. (only applies if there is an Event Listener for pairing setup and the puzzle piece has a physics body)

MaxPanX

A number value. This is the max speed that panning gestures can move objects on the X axis. This is particularly useful if the camera itself is going to be panned.

MaxPanY

A number value. This is the max speed that panning gestures can move objects on the Y axis. This is particularly useful if the camera itself is going to be panned.

EaseOutPanning

A Boolean value. Set YES and panning gestures will be eased out (continued slightly after the user has stopped touching the screen).

Elements

Elements dictionaries in the property list allow you to change properties of an element at runtime, outside of Scene editor.

An element is a color sprite dragged to the page from the object library. Most properties of elements are initially set in Scene editor. An element’s properties include its texture, size, rotation, z depth, location, blend mode, animation, physics properties, and any Actions defined by the Scene.

Events change Elements

An Elements dictionary can set properties of an element, such as whether an element is hidden or not. Most changes to an Element are made by Events later on. So you might run Actions to change the animation, to set a different texture, move it, hide it, show it, etc. Point is, each of your dictionaries inside the Elements dictionary, will probably be relatively concise, and clutter-free.

Add Keys to:

Root  Elements
or
Root  Pages  MyPage  Elements

Elements can be defined in the Root or inside a Pages dictionary

You can define an Elements dictionary on a per-page basis, or for commonly used elements in your Scene, you can also use the Elements dictionary in the Root. If both dictionaries had the same name, priority is given to the one for that particular page.

The Root Elements dictionary is intended for things like pause buttons, thumbnail images to jump to other pages, directional arrows to move character around, and other things that would potentially be used across multiple pages.

Assign most elements to the “Element” class

Elements are simply items on a page. When you add an element to a page, you assign it a custom class of “Element”, so the kit can manipulate it. By giving your image a custom class of "Element" you’re extending its capabilities so it can do more. For example, it can function as a button.

If you do not need to interact with a sprite node, simply add a Color Sprite to the Scene, and give it a texture. You don’t need to assign Class=Element unless the kit will interact with that sprite in some way; for example to change a property of the element or to animate it. A background image might not need Class=Element.

Elements have Properties

See Elements properties.

Add an element to the page

Properties of Elements

Use an Elements dictionary to set the properties of any element which has class=“Element” assigned.

Add Keys to:

Root  Elements
or
Root  Pages  MyPage  Elements

Key Permissible Values

Hidden

A Boolean property. Set to YES or NO to show or hide an Element initially. This is an important property because your Scene might have dozens of hidden Elements to use later. Events could set these Elements to show themselves (and move into their proper locations later).

AllowSomeHiddenInteractions

A Boolean property. Default is NO when excluded from property list. Setting this to YES will make it so the Element can trigger some interactions when hidden. For example you might tap this hidden element to reveal another element in the scene. This property has no affect on the Show or ShowOrHide Events if they apply to the current node tapped. By default a hidden element shouldn’t allow for interaction, but this gives you the option to toggle that.

IgnoreAllTouchEventsWhenHidden

A Boolean property. Default is NO when excluded from property list. Setting this to YES will make it so if the Element is hidden, it will completely be ignored from triggering touch events.

SizeWidthToSceneWidth

A YES value will make the Element’s height match that of the scene (great for background art like the sky).

SizeHeightToSceneHeight

A YES value will make the Element’s height match that of the scene.

PositionPercentageHeight

A decimal value to position an Element based on the height of the scene. Great for background elements like the sky. For example, 0.5 would put the Element at 50 percent of the height on the y axis (centered).

PositionPercentageWidth

A decimal value to position an Element based on the width of the scene. Great for background elements like the sky. For example, 0.5 would put the Element at 50 percent of the width on the x axis (centered).

Alpha

A number value for the alpha. 1 is 100%. This is a strangely absent option from the Scene editor. It is useful to set this to 0 if you want to perform an initial fade in Action.

ZDepth

A number value for the z depth. This can be set much easier in the scene editor, but we’ve included it anyway.

CameraOffset

A String value in {x, y} format to offset the Element IF it is following the Camera.

CameraOffsetPhone

A String value in {x, y} format to offset the Element IF it is following the Camera and the device is an iPhone. This value is ignored on the iPad.

MaxX

A Number value for the max X value the Element can be if it is following the user’s touch or being moved around dynamically.

MaxY

A Number value for the max Y value the Element can be.

MinX

A Number value for the minimum X value the Element can be.

MinY

A Number value for the minimum Y value the Element can be.

Other Dictionaries

Where Dictionaries can appear

This topic indicates where each type of dictionary can appear in the property list (List.plist), with links to pages describing keys each dictionary supports.

Dictionary Root Pages Elements Labels Pools PageOrder ActionsPool Actions

Root
Short description about the dictionary.

x

x

x

x

x

x

x

Pages
Short description about the dictionary.

x

x

x

x

x

x

x

Elements
Describes properties of sprites globally or specific to sprites on a page.

x

x

x

x

x

x

Labels
Short description about the dictionary.

x

x

x

x

x

x

Pools
Short description about the dictionary.

x

x

x

x

x

x

x

PageOrder
Short description about the dictionary.

x

x

x

x

x

x

x

ActionPool
Short description about the dictionary.

x

x

x

x

x

x

x

Actions
Short description about the dictionary.

x

x

x

x

x

x

x

x

Events
Short description about the dictionary.

x

x

x

x

x

x

x

x

EventListeners
Short description about the dictionary.

x

x

x

x

x

x

x

x

EventTimers
Short description about the dictionary.

x

x

x

x

x

x

x

Generators
Short description about the dictionary.

x

x

x

x

x

x

x

x

TapControls
Short description about the dictionary.

x

x

x

x

x

x

x

x

TapControlsSecondary
Short description about the dictionary.

x

x

x

x

x

x

x

x

RotationControls
Short description about the dictionary.

x

x

x

x

x

x

x

x

StickNodeToNode
Short description about the dictionary.

x

x

x

x

x

x

x

x

What about the Settings dictionary that appears below Root > Pages > PageName > Settings? That one isn’t listed here. Are there more? Is this the correct way to describe where things go?

Root dictionary

The Pages dictionary is located in Root  Pages only. It stores child dictionaries named after each scene in a project.

image046

A page-level dictionary below Pages may contain properties from these categories:

Pages dictionary

Labels dictionary

Document here.

Pools dictionary

Document here.

PageOrder dictionary

Document here.

ActionPool dictionary

Document here.

Actions dictionary

Document here.

Events dictionary

Document here.

EventListeners dictionary

Document here.

EventTimers dictionary

Document here.

Generators dictionary

Document here.

TapControls dictionary

Document here.

TapControlsSecondary dictionary

Document here.

RotationControls dictionary

Document here.

StickNodeToNode dictionary

Document here.

External learning resources

Justin Dike’s documentation

Justin Dike provides documentation, a discussion forum, and resources for the kit at CartoonSmart.com. Login to the website before opening the links below.

Key Features

Product information page listing key features of the kit.

Introductory video

Explains how to use the kit without delving into details. Get the 'big picture' before reading documentation. Don’t worry if something doesn’t make sense. Later, it will. See So it’s your first time with Xcode and the Story Tellers iOS Starter Kit 2…. Now what?

Preview the Kit

Demonstrates the scene editor and how animations work in the kit. This video is part of Code Creation training for programmers, but it’s high level enough for everyone. See Preview the Kit

Storyteller’s Kit Documentation

After you login to Cartoonsmart.com, you can access StoryTeller’s Kit v2 documentation. To read the doc offline, you can download it in PDF or iBooks format. This documentation explains how to use the kit. It also provides reference information about settings, events, listeners, and so on. Read this first if you are new to the kit.

Video Walk-Throughs of Demo Pages

These videos explain how to use the kit. Watch these after reading the doc.

Build a book video tutorials

To see how the demo app was created, watch Building a Book with the Story Tellers Kit.

Code Creation Videos

Code creation videos are for programmers. They explain the Swift code Justin Dike wrote to create the kit. For details, see Code Creation Videos.

Forum

The place for subscribers to ask questions. sSee The Story Tellers Kit 2 for iOS or tvOS Apps

YouTube

See Cartoonsmart’s YouTube Page and Build a Book App with Xcode and Story Tellers Kit 2.

Vimeo

See the Vimeo Home Page and Tutorials page.


Code Creation Videos

Creation videos are for programmers. They explain the Swift code Justin Dike wrote to create the kit. To view them (and keep track of your progress):

  1. Navigate to the Subscriber Portal page.

  2. Below iOS and tvOS Tutorials, expand Story Tellers Kit 2: Creation Videos - Subscription Access.

There are 10 units in this course. Each unit has a set of modules (videos).

Unit

Module 1: Initial Setup

Module 2: Page Events, Next, Previous, Random Pages, and Transitions

Module 3: Element Display - Showing, Hiding, Removing, and Moving Based on Touch

Module 4: Running Actions from the Property List

Module 5: Setting Up Dynamic SKLabelNodes

Module 6: Particle Emitters, Event Timers, Listeners and Element Generators

Module 7: Tap and Rotation Gestures

Module 8: Sounds, Textures, and Camera Follow Options and More

Module 9: Physics

Module 10: Conditional Values, Saving Texture Preferences, Touch Up Events, Inventory Slots / Paths and More

Swift information

To use the kit, you don’t need to program in Swift, but it helps to learn the basics of Xcode, Apple’s integrated development environment.

Swift.org

Information about the how to use the Swift programming language. See Getting Started.

Free Swift Stuff

Resources to make coding in Swift easier. See Free Swift Stuff

Apple Documentation

Apple Developer

Apple Developer Site

SpriteKit Programming Guide

See this article.

Scene Transitions explained

See SKTransition.

Next/Prev Buttons

To create Next/Prev navigation buttons, you first define a browse sequence in a PageOrder pool (array). Then you can add Next/Prev buttons.

Define a browse sequence of pages

Before adding buttons that navigate to next and previous pages, define Arrays for the page order of the book. See Page Order (Page 18) of the StoryTeller’s Kit documentation.

image007

Add Next/Previous buttons

Define here how to create a scene containing only the buttons. That scene can be dragged into other scenes, to create a similar set of buttons.

The 'master' scene should not have elements, events, and so on in the plist. Those are added to the Root > Elements node in the plist. But you can control individual page transitions by embedding the same code in the

Add a Color Sprite

  1. Select the Object Inspector.

  2. Drag a Color Sprite to the scene.

    image005
  3. Use the Attributes inspector to set its Texture Property to an image. To do this, select from the drop list.

  4. Type a name in the Name box. This names the sprite instance. This is the name you’ll refer to the sprite in the property list.

  5. Use the Custom Class inspector to set the sprite’s Custom Class property to Element. Since element is a subclass of the SKSpriteNode class, it adds additional methods and properties.

  6. Size and position the image.

Add a Light to illuminate the Sprite or Scene

Just getting started

Techniques not organized or written about yet

What are the minimum techniques needed to accomplish our goals?

Please ignore the remainder of the doc from this point forward. It’s mostly rough notes.

Run an animation when a sprite is clicked

An anticipated common action that will allow kids to interact with otherwise static scenes.

Hide a sprite when it is clicked

Make something go away when it is clicked on.

To loop more than 1 timeline action

  1. Select MoveUp and MoveDown actions.

  2. Right-click.

  3. Click Infinite Loop icon

AnimateWithTextures action

  1. Drag a selection of images into xcassets folder, or drag a sprite atlas folder into the tree. An atlas folder is any folder containing images, whose name has an .atlas suffix. Example: running_figure.atlas.

  2. Add Animate node

  3. Click the icon to show images.

  4. Select images to assign to the animation.

  5. Drag them into the blank list of images.

What’s discussed in Lesson 1 Initial Setup

How to build a simple book from scratch.

Create a new project by duplicating the CleanCopy folder

00:44 To create a new project, copy the CleanCopy folder from the StoryTeller’s kit. In addition, create a WorkingAssets folder to store images used in the project. Make WorkingAssets a sibling folder of CleanCopy.

Use PNGs instead of JPG images

1:43 PNG supports transparency, so it’s a better choice than JPG for most images.

New Project settings

02:14 Settings of a new project, after you open a clean copy of StoryTellersKit2.xcodeproj.

General Settings:

Bundle Identifier (sometimes called AppId) Version Number (of StoryTeller’s Kit) Build Number (of StoryTeller’s Kit) Device Orientation

List.plist

03:19 Property list overview.

Don’t rename the kit

03:45

2D animation software

Ask Paul, what software does he use or recommend for 2D animation, with bones/splines?

Harmony

A popular paid program is Harmony from http://www.toonboon.com.

Synfig Studio

There are open source alternatives. Pencil 2D is popular, but it doesn’t do tweening or allow the use of 'bones' to animate simple movements. Synfig Studio does these things, but it will take some time to learn. But it comes with great documentation that includes video tutorials.

Full-featured bone system allows to create cutout animation using bitmap images or control your vector artwork. The Skeleton Distortion layer allows to apply complex deformations to bitmap artwork.

Bee Scene page

The Bee Scene page demonstrates how to:

Play a background sound with a page opens

EXPLAIN HERE.

Animate nodes on a path

Animate Nodes from point to point along a path

Path-based animation is possible with the kit. But instead of drawing a path line, you add a series of invisible, empty sprite nodes as path points.

When the AnimateNodesOnPath event is called, it moves a sprite to the next path point. Calling AnimateNodesOnPath moves to the next path point.

Use a timer to continuously animate nodes on a path

Explain here how to continuously animate nodes on a path using a timer

Store textures in a pool

EXPLAIN HERE.

Create a 2-state toggle button

EXPLAIN HERE.

Toggle background sound off or on

EXPLAIN HERE.

Detect any collision

The first bee responds by playing a sound whenever it collides with any of the other bees.

Making Actions from Texture Atlases

In realtime computer graphics, a texture atlas (also called a sprite sheet) is an image containing a collection of smaller images, usually packed together to reduce the atlas size. …​ A sub-image is drawn using custom texture coordinates to pick it out of the atlas.
— Wikipedia

In StoryTeller’s kit, a texture atlas is a folder of images files with an .atlas extension.

This topic explains:

  • How to create a texture atlas folder, and import it into the kit.

  • How to group related animations. For example, to organize animations of the same character.

  • How to create Action that runs the animation, while optionally moving, scaling, or playing a sound file. Your custom action can be used in scene editor, or it may be invoked by a property list.

Create a texture atlas folder

Suppose you have a folder of images, named SuperBoy Running. To turn that folder into a texture atlas:

  1. Rename the folder to SuperBoy_Running.atlas.

    image027
    To ensure that all images have unique names, name each image starting the the name of the character.
  2. In Xcode, drag the atlas folder into a kit project, below the TextureAtlases folder.

  3. Click Confirm when prompted.

    image028

    The project should look like this:

    image029

Let’s organize all animations for SuperBoy in a group.

  1. Right-click the SuperBoy_Running.atlas folder.

  2. Select New Group from Selection.

  3. Name the group SuperBoy. Now you have a place to add additional SuperBoy animations.

Create an Action that runs an animation

This procedure is similar to Create a reusable action that can be run by Events, except that it shows how to create an action that runs an animation.

In this example, we will create an action that runs the SuperBoy running texture atlas, while moving it 500 pixels to the right, and playing a background sound.

The resulting custom action can be dragged into scene editor, invoked by an event in the property list, and so on.

  1. Select the Actions folder.

  2. Select File > New > File.

  3. Select SpriteKit Scene.

  4. Click Next.

  5. Name the file SceneForReuseActions or something unique. Save to the StoryTellersKit2 folder.

  6. Click Create. If new scene is not in the Actions folder, drag it there to keep things organized if you like.

  7. Click the new scene file to make sure it is loaded in the scene editor. Confirm that the scene is loaded by looking at the hierarchal breadcrumbs at the top of the screen.

  8. Set the size and orientation of the scene.

  9. Click + (next to the Filter option).

    image015
  10. When prompted to create a new file, type the name of an action you intend to create. “ButtonPushAction” for example. Click Create.

    image016
  11. When prompted to save a file, type SuperBoy_Actions or type a different name. Save to the StoryTellersKit2 folder.

  12. Click Create.

  13. Select SuperBoy_Actions.sks in the left pane.

  14. Click the Select button. Then select the scene file created in Step 4 (SceneforReuseActions.sks).

  15. Click + to name a new action. Call it SuperBoy_Running_Right.

  16. Click Create.

  17. Drag an AnimateWithTextures action to the action.

  18. Filter for Running, and drag SuperBoy_Running_nnn.png images to the Textures box.

  19. Set the animation to loop.

  20. Next, let’s move the animation across the scene. Drag a Move action below the action. Set it to move 700 pixels the right, in 3 seconds.

    image031
  21. Add a PlaySoundFileNamed action to the scene. Import a sound file if necessary.

  22. Add additional actions as needed, to scale, flip or otherwise change the animation.

Run the animation action from any scene

At this point, in any scene, you can run the animation without recreating it in scene editor.

  1. Add a color sprite.

  2. Set its texture to the first texture of the animation.

  3. In scene editor, drag the custom action named SuperBoy_Running_Right into the timeline.

    image032
  4. Click Animate. The action will play with sound and any effects you have added.

Create a reusable action that can be run by Events

Actions are not necessarily tied to a particular sprite. You can create actions in a scene file, and apply them to any sprite you choose, in any scene. The name of the scene hosting the action is not significant. You merely need to know the name of the action.

The action can be as simple as moving an object left or right. Or, it might animate a texture atlas. Either way, they resulting action becomes a new action in the Actions list, and you can invoke it from a property list.

  1. Select the Actions folder.

  2. Select File > New > File.

  3. Select SpriteKit Scene.

  4. Click Next.

    image014
  5. Name the file SceneForReuseActions or something unique. Save to the StoryTellersKit2 folder.

  6. Click Create. If new scene is not in the Actions folder, drag it there to keep things organized if you like.

  7. Click the new scene file to make sure it is loaded in the scene editor. Confirm that the scene is loaded by looking at the hierarchal breadcrumbs at the top of the screen.

    image023
  8. Set the size and orientation of the scene.

    image024
  9. Click + (next to the Filter option).

    image015
  10. When prompted to create a new file, type the name of an action you intend to create. “ButtonPushAction” for example. Click Create.

    image016
  11. When prompted to save a file, accept MyActions or type a different name. Save to the StoryTellersKit2 folder.

  12. Click Create.

  13. Select MyActions.sks in the left pane.

  14. Click the Select button. Then select the scene file created in Step 4 (SceneforReuseActions.sks).

    image017
    image025
  15. Create additional actions as needed, by pressing +.

    image018
  16. Configure the action by dragging SpriteKit actions into the timeline.

    image026

    As you can see, this technique allows you to create a named SpriteKit action that is not associated with a particular sprite.

Animating using plist alone

This section contains notes from trying to animate using saved actions or actions defined in the property list.

RunAction event

You can run a saved action when the scene starts by using the RunAction event.

image049

In this example, the name of the saved action is WalkSavedAction. The sprite is named robot.

Glossary

ActionPool

A dictionary whose key is set to the name of an action, and whose value is the element the action should affect. All actions in an ActionPool run at once, not sequentially.

Actions

Manipulation of sprites by Scene editor.

Boolean

YES or NO

Element

A color sprite dragged to the page from the Object Library. To be manipulated by agh kit, the element must be assigned Class = Element.

Events

Focus on things that can’t be done with Scene Editor actions.

Node

Anything descended from the SKNode class; a sprite, particle emitter, camera, etc.

Pool

An array from which 1 item is selected at random.