Hey I'm new to Xcode so maybe this has a very easy fix and in that case I'm sorry but I've tried everything and looking online and nothing has worked so far. Basically I created a continueButton to transition to the next scene in the app once the level has been completed. Heres what its code looks like
UIButton *continueButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
continueButton.frame = CGRectMake(120, 150, 80, 44);
[continueButton setTitle:@"Continue" forState:UIControlStateNormal];
[continueButton addTarget:self action:@selector(SKTransition:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:continueButton];
Then I defined what happens when I click on the continueButton as this.
-(void)buttonPressed:(UIButton *)sender
{
SKAction *levelChange = [SKAction runBlock:^{
SKTransition *doors = [SKTransition
doorsOpenVerticalWithDuration:2];
SKScene *Level2Scene = [[Transition2Scene alloc]
initWithSize:self.size];
[self.view presentScene:Level2Scene transition:doors];
[self runAction:levelChange];
}];
}
However whenever I run that app and click on the continueButton I get this error.
2014-07-27 21:14:14.225 MazeGame[40846:60b] -[Level1Scene SKTransition:]: unrecognized selector sent to instance 0x14158670 (lldb)
at this point in the code.
#import <UIKit/UIKit.h>
#import "SpriteAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([SpriteAppDelegate class]));
}
}
I don't exactly know what went wrong or what I should do and would really appreciate some help/advice thanks!