There is a hero that is controlled by tapping on the screen. I want the hero too look a little different every time the screen gets touched.
What I did is setting up two images that are a little different. I want the image of the hero to be changed when there is a touch event.
Until now I set up an array to save the information in but it kinda won't work out:
NSMutableArray *heroFrames = [NSMutableArray array];
NSString* textureName = nil;
if (UITouchPhaseBegan) {
textureName = @"hero1.gif";
}
else {
textureName = @"hero2.gif";
}
SKTexture* texture = [SKTexture textureWithImageNamed:textureName];
[heroFrames addObject:texture];
[self setHeroFrames:HeroFrames];
self.hero = [SKSpriteNode spriteNodeWithTexture:[_heroFrames objectAtIndex:1]];
I get an exception when running this.. Any other idea how to achieve my problem?
Thanks guys!