cocos2d-iphone – Cocos2d淡入/淡出动作,永远重复

我正在尝试为我的基于CCSprite的Player类创建一个方法来启动播放器实例淡入和淡出,直到通过调用stopAllActions停止.

在我的Player类中,我有

- (void)pulse
{
    [self setopacity:1.0];
    CCAction *fadeIn = [CCFadeto actionWithDuration:0.5 opacity:0.5];
    CCAction *fadeOut = [CCFadeto actionWithDuration:0.5 opacity:1.0];

    CCSequence *pulseSequence = [CCSequence actions:
                                 fadeIn,// I get a warning about incompatible pointer types...
                                 fadeOut,nil];
    [self runAction:pulseSequence];
}

这不起作用,也没有解决永远重复的问题.我知道我应该使用CCRepeatForever,但我没有看到如何正确实现它.

谢谢!

我没有运行这个,但我认为其他人已经成功了:
- (void)pulse
{
    [self setopacity:1.0];
    CCFadeto *fadeIn = [CCFadeto actionWithDuration:0.5 opacity:127];
    CCFadeto *fadeOut = [CCFadeto actionWithDuration:0.5 opacity:255];

    CCSequence *pulseSequence = [CCSequence actionOne:fadeIn two:fadeOut];
    CCRepeatForever *repeat = [CCRepeatForever actionWithAction:pulseSequence];
    [self runAction:repeat];
}

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...