title: Delete child SKSpriteNode
body: <p>Basically I am trying to make it so that when the user hits a fuel tank the old tank disappears and a new one is spawned in a random location. Right now it's detecting the collision but I can't get rid of the child. It will just add a new fuel tank without getting rid of the old one.</p>
  
  <p>What can I do to remove the old child and generate a new one? removefromparent and removeallchildren is not working(nslog shows "move" s I am definitely getting to that statement after a detected collision)</p>
  
  <pre><code>- (void) fuelGenerate {
      //make a fuel tank
  
      for (int j=1; j&lt;2; j++) {
          SKSpriteNode *fuel = [SKSpriteNode spriteNodeWithImageNamed:@"fuel.png"];
  
          fuel.position = CGPointMake(arc4random_uniform(self.frame.size.width), arc4random_uniform(self.frame.size.height));
          [fuel setScale:0.6];
          fuel.zPosition = 1;
          fuel.shadowCastBitMask = 1;
  
          fuel.name = @"fuelNode";
          fuel.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:fuel.frame.size];
  
          fuel.physicsBody.dynamic = FALSE;
  
          fuel.physicsBody.affectedByGravity = false;
          fuel.physicsBody.usesPreciseCollisionDetection = YES;
          fuel.physicsBody.categoryBitMask = fuelCategory;
  
          fuel.physicsBody.collisionBitMask = fuelCategory | fireCategory;
          fuel.physicsBody.contactTestBitMask = fireCategory;
  
  
          if (FuelGen == 1) {
  
              [self addChild:fuel];
  
          } else if (FuelGen == 0) {
  
              NSLog(@"Move");
  
              [fuel removeFromParent];
              [self addChild:fuel];
              FuelGen == 1
          }
  
      }
  }
  </code></pre>