TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Sprite Kit helpers, extensions and utilities.
The best and easiest way is to use CocoaPods.
pod 'ISSpriteKit'
Highly customizable node that simulates a parallax scroller.
#import "MyScene.h"
#import "ISParallaxNode.h"
@interface MyScene ()
@property (strong, nonatomic) ISParallaxNode *parallaxNode;
@end
@implementation MyScene
- (id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
self.parallaxNode = [[ISParallaxNode alloc] initWithImageNamed:@"Horizontal" direction:ISScrollDirectionLeft];
[self addChild: self.parallaxNode];
}
return self;
}
- (void)update:(NSTimeInterval)currentTime {
[self.parallaxNode update:currentTime];
}
@end
ISParallaxLayer can contain several ISParallaxNodes.
#import "MyScene.h"
#import "ISParallaxLayer.h"
#import "ISParallaxNode.h"
@interface MyScene ()
@property (strong, nonatomic) ISParallaxLayer *parallaxLayer;
@end
@implementation MyScene
- (id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
self.parallaxLayer = [ISParallaxLayer node];
ISParallaxNode *parallaxNodeRightDirection = [[ISParallaxNode alloc] initWithImageNamed:@"Horizontal"
direction:ISScrollDirectionRight];
[self.parallaxLayer addParallaxNode:parallaxNodeRightDirection];
ISParallaxNode *parallaxNodeLeftDirection = [[ISParallaxNode alloc] initWithImageNamed:@"Horizontal"
direction:ISScrollDirectionLeft];
parallaxNodeLeftDirection.position = CGPointMake(0, self.frame.size.height / 2);
[self.parallaxLayer addParallaxNode:parallaxNodeLeftDirection];
[self addChild:self.parallaxLayer];
}
return self;
}
- (void)update:(NSTimeInterval)currentTime {
[self.parallaxLayer update:currentTime];
}
@end
Check out the example project for more details.
ISSpriteKit is licensed under the MIT Licence.