我目前一直在寻找解决方案来解决在Objective-C中修复SKEmitterNode的问题,之前我在旧版本的Xcode中没有遇到任何问题。代码的前提是执行水果忍者刀片效果,它使用了一个很薄的刀片效果,现在它完全放大了particleTexture,现在看起来就像气泡。
- (instancetype)initWithPosition:(CGPoint)position TargetNode:(SKNode *)target Color:(UIColor *)color
{
if (self = [super init])
{
self.position = position;
//Where the image node is and stacks on the blade effect
self.tip = [SKSpriteNode spriteNodeWithImageNamed:@"Digsby.png"];
self.tip.size = CGSizeMake(50, 50);
self.tip.zRotation = 0.785398163;
self.tip.zPosition = 10; //10
self.tip.name = @"skblade";
[self addChild:self.tip];
SKEmitterNode *_emitter = [self EmitterNodeWithColor:color];
_emitter.targetNode = target;
_emitter.zPosition = 0;//0
[self.tip addChild:_emitter];
[self setScale:0.5]; //0.5
}
return self;
}
- (SKEmitterNode *)EmitterNodeWithColor:(UIColor *)color
{
SKEmitterNode *emitterNode = [SKEmitterNode new];
emitterNode.particleTexture = [SKTexture textureWithImage:[UIImage imageNamed:@"spark.png"]];
emitterNode.particleBirthRate = 2000; //3000
[emitterNode setScale:0.1];
emitterNode.particleLifetime = 0.2;
emitterNode.particleLifetimeRange = 0;
emitterNode.particlePositionRange = CGVectorMake(0.0, 0.0);
emitterNode.particleSpeed = 0.0;
emitterNode.particleSpeedRange = 0.0;
emitterNode.particleAlpha = 0.1;
emitterNode.particleAlphaRange = 0.2;
emitterNode.particleAlphaSpeed = -0.45;
emitterNode.particleScale = 0.5;
emitterNode.particleScaleRange = 0.001;
emitterNode.particleScaleSpeed = -1;
emitterNode.particleRotation = 0;
emitterNode.particleRotationRange = 0;
emitterNode.particleRotationSpeed = 0;
emitterNode.particleColorBlendFactor = 1;
emitterNode.particleColorBlendFactorRange = 0;
emitterNode.particleColorBlendFactorSpeed = 0;
emitterNode.particleColor = color;
emitterNode.particleBlendMode = SKBlendModeAdd;
return emitterNode;
}