I am making a game in Cocos2d & SpriteBuilder. Is it possible to switch to a new scene by taping on the screen? I know how to do it with a button.
So if someone out there can help me, that would be awesome!:)
Yes, it works the same way as for a button. When you understand how to handle touches the implementation is very easy:
First turn on user interaction for the node that shall accept touches:
self.userInteractionEnabled = TRUE;
Then implement the touchBegan:
method:
- (void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
// if you want to only react to touches in certain areas add check here
[[CCDirector sharedDirector] replaceScene:myScene];
}
For a basic introduction to touch handling in Cocos2d 3.0 read: https://www.makegameswith.us/gamernews/366/touch-handling-in-cocos2d-30