SpriteKit 辅助工具和扩展。
STParallaxNode 是一个节点,可以以高度定制的方式创建视差效果。
两个子类:STControlNode 和 STControlSprite 允许在你的节点上添加一些控制方法。
这些方法允许在检测到 touchUp 事件时发出警告。
- (void)setTouchUpTarget:(id)target action:(SEL)action;
- (void)setTouchUpBlock:(dispatch_block_t)touchUpBlock;
这些方法允许在检测到 touchDown 事件时发出警告。
- (void)setTouchDownTarget:(id)target action:(SEL)action;
- (void)setTouchDownBlock:(dispatch_block_t)touchDownBlock;
这些方法允许在检测到 touchUpInside 事件时发出警告。
- (void)setTouchUpInsideTarget:(id)target action:(SEL)action;
- (void)setTouchUpInsideBlock:(dispatch_block_t)touchUpInsideBlock;
这些方法允许在检测到 touchUpOutside 事件时发出警告。
- (void)setTouchUpOutsideTarget:(id)target action:(SEL)action;
- (void)setTouchUpOutsideBlock:(dispatch_block_t)touchUpOutsideBlock;
这些方法允许在检测到 touchDown 事件时发出警告。
- (void)setTouchDownTarget:(id)target action:(SEL)action;
- (void)setTouchDownBlock:(dispatch_block_t)touchDownBlock;
这些方法允许轻松解档发射器资源。
+ (SKEmitterNode*)emitterWithResourceNamed:(NSString*)resourceName;
+ (SKEmitterNode*)emitterWithResourceNamed:(NSString*)resourceName inBundle:(NSBundle*)bundle;
这个类别添加了一些运行动作的便利方法。
- (void)runActionsSequence:(NSArray*)actions;
- (void)runActionsSequenceForever:(NSArray*)actions;
- (void)runActionsGroup:(NSArray*)actions;
- (void)runActionsGroupForever:(NSArray*)actions;
- (void)runAction:(SKAction*)action afterDelay:(NSTimeInterval)delay;
提出对 SKScene 的 nodeAtPoint:
方法的替代算法,以便将触摸传递到指定的节点,考虑到其 userInteractionEnabled 值。换句话说:如果节点的 userInteractionEnabled 值为 NO,则触摸将转发到下面的节点。
增加了一些易于操作 CGPoint 和 CGSize 的功能。
要将此组件包含到你的项目中,我建议你使用 Cocoapods
pod "STSpriteKit"
添加到您的 Podfile。