gpt4 book ai didi

iphone - Cocos2d v2.0 : unable to add CCParticleSystem to scene

转载 作者:行者123 更新时间:2023-11-29 04:30:31 26 4
gpt4 key购买 nike

我正在尝试将 CCParticleFlower 添加到我的 Cocos2d v2.0(启用了 ARC)HelloWorld 场景中。这就是我正在运行的代码:

CCParticleFlower* system = [[CCParticleFlower alloc] initWithTotalParticles:10];
// Set some parameters that can't be set in Particle Designer
// system.positionType = kCCPositionTypeFree;
// system.autoRemoveOnFinish = YES;
system.visible = TRUE;
[system setDuration:4.0f];
system.position = CGPointMake(150.0f, 100.0f);
[self addChild:system z:0];

我尝试了几种变体,但我不确定我做错了什么,因为我从未设法运行它。

例如:

CCParticleSystem * system = [CCParticleFlower node];
system.position = CGPointMake(150.0f, 100.0f);
[self addChild:system];

最佳答案

  1. 确保在您的项目中包含粒子系统所使用的纹理。
  2. 尝试重置系统并查看是否有效。 [系统重置]。您甚至可以尝试[系统计划更新],以防其更新不正确。

关于iphone - Cocos2d v2.0 : unable to add CCParticleSystem to scene,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11799415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com