如何在 Cocos2d 3 中通过录制屏幕来切换场景



我正在Cocos2d和SpriteBuilder中制作游戏。是否可以通过点击屏幕切换到新场景?我知道如何使用按钮来做到这一点。

所以如果有人能帮助我,那就太棒了!:)

是的,它的工作方式与按钮相同。 当您了解如何处理触摸时,实现非常简单:

首先为应接受触摸的节点打开用户交互:

self.userInteractionEnabled = TRUE;

然后实现touchBegan:方法:

- (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];
}

有关 Cocos2d 3.0 中触摸处理的基本介绍,请阅读:https://www.makegameswith.us/gamernews/366/touch-handling-in-cocos2d-30

最新更新