Question

Hi I'm makking a SpriteKit game, which based on EmitterNode objects. I've designed the start scene and put on some emitternodes. I also made them to move across the screen. Now I would like them to leave a "pattern" for a really small time. As I seen in the "IOS 7 Tech Talks: 2d Game With sprite kit" video, I modyfied the target node to self:

Emitternode.targetNode = self;

I want the same with my nodes , that the developer used in the video. However this line modify my node, makes it bigger and much faster. I'll link some screenshots. Here the Code , I create the Emitternodes with this:

 SKEmitterNode *Emitternode = [NSKeyedUnarchiver unarchiveObjectWithFile:pathtoadd];
 Emitternode.position = CGPointMake(arc4random_uniform(Scene.size.width-40)+20, arc4random_uniform(Scene.size.height-60)+20);
 [Emitternode setScale:0.3f];
 Emitternode.targetNode = self;
 [self addChild:Emitternode];

My screenshoots: THIS without the targetnode option: enter image description here THIS With the targetnode option : enter image description here

As you can see, In the second case they're much bigger. I woud like to have the same size, but with the targetnode option. Any idea?

Était-ce utile?

La solution

As I can see, you set the scale of the emitter-node to 0.3. This means all its child-nodes (particles) are also being scaled to 0.3. With the targetNode = self the created particles are not children of the SKEmitterNode anymore but of the node that is being represented by "self" (your scene). If your scene has the default scale of 1.0 than the particles will scale will also be 1.0.

Changing the size of the emitter with the particle-editor and not programmatically will remain the size.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top