SKSpriteButton is something obvious but somehow missing from the official SpriteKit library.
This library should be very straightforward to use.
Set tappedColor
property for a different display color when tapped.
Since this widget inherits from SKSpriteNode, which will only show texture if both texture
and color
are set. tappedColor
will not be shown if the button has a texture.
Set tappedTexture
property for displaying a different texture when tapped.
Set moveType
property for different move types supported move types are:
public enum MoveType {
case alwaysHeld
case releaseOut
case releaseFast
case reentry
}
The names should be self-explainatory. But still I put a screencast for different move type behaviors.
There is no more, check SKSpriteButton.swift
for public APIs.
I've built a simple example project to elaborate on how to use this widget. The example project shows how "move types" differ from each other.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Note: I've actually included all files needed to compile the project in the git repo. You should be able to run the example even without pod install
.
SKSpriteButton is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SKSpriteButton'
hanjoes, hanzhou87@gmail.com
SKSpriteButton is available under the MIT license. See the LICENSE file for more info.
hanjoes
nader-eloshaiker