/SKSpriteBuddy

Framework to work with assets generated by the InkAnimator app in Sprite Kit based games.

Primary LanguageSwiftMIT LicenseMIT

SKSpriteBuddy

SKSpriteBuddy is the framework to work with game assests generated by Sprite Buddy app within SpriteKit based games. Always that you export your assets on Sprite Buddy, the iPad app exports a <EntityName>.xml file that have all the information about the game element's structure, skins and animations. And your assets organized in folders that represents the entity's bones. Use SKSpriteBuddy framework to instantiate entity's objects, load and set skins and load and run animations.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

SKSpriteBuddy is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SKSpriteBuddy'

How to use

  • Drag and drop the <EntityName>.xml file into your SpriteKit project on Xcode.
  • Drag and drop the asset folders into the Assets.xcassets folder.
  • Use the SKInkAnimator API to instantiate entity objects, set skins and run animations

Instantiating an entity object:

import SKSpriteBuddy
...
let entity = try await IAEntity(withName: "EntityName")
self.scene.addChild(entity)

Setting entity's skins:

try await entity.setSkin(named: "Dark_Knight")

Running animations:

// run the animation once
try await entity.run(animationNamed: "Running")

// Run the animation 3 times
try await entity.run(animationNamed: "Idle" , times: 3)

// Run the animation forever
try await entity.runForever(animationNamed: "Running")

Preloading Skins:

// Preloading the textures for skin named "Knight"
try await entity.preload(skinNamed: "Knight")

// Preloading textures for a set of skins
try await entity.preload(skins: ["Dark_Knight", "Light_Knight", "Golden_Knight"])

// Releasing unused textures from memory
entity.releaseSkin(named: "Dark_Knight")

Preloading Animations:

// Preloading the animation named "Running"
try await entity.preload(animationNamed: "Running")

// Preloading a set of animations
try await entity.preload(animations: ["Running", "Idle"])

// Releasing unused animations from memory
entity.releaseAnimation(named: "Running")
pod "SKSpriteBuddy"

Author

rafael.vrmoura@gmail.com

License

SKSpriteBuddy is available under the MIT license. See the LICENSE file for more info.