title: Only one sprite on the scene at once Cocos2D 3.x
body: <p>The sprite appears every time the screen is touched, then it shoots to the desired area. How would i make it that only one sprite will be on the scene at a time until it exits the scene or hits an object? (even though the screen is touched multiple times)</p>
  
  <p>This is the projectile code</p>
  
  <pre><code>- (void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
  // 1
  CGPoint touchLocation = [touch locationInNode:self];
  
  // 2
  CGPoint offset    = ccpSub(touchLocation, _player.position);
  float   ratio     = offset.y/offset.x;
  int     targetX   = _player.contentSize.width/2 + self.contentSize.width;
  int     targetY   = (targetX*ratio) + _player.position.y;
  CGPoint targetPosition = ccp(targetX,targetY);
  
  // 3
  CCSprite *projectile = [CCSprite spriteWithImageNamed:@"projectile.png"];
  projectile.position = _player.position;
  projectile.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius:projectile.contentSize.width/2.0f andCenter:projectile.anchorPointInPoints];
  projectile.physicsBody.collisionGroup = @"playerGroup";
  projectile.physicsBody.collisionType  = @"projectileCollision";
  [_physicsWorld addChild:projectile];
  
  // 4
  CCActionMoveTo *actionMove   = [CCActionMoveTo actionWithDuration:1.5f position:targetPosition];
  CCActionRemove *actionRemove = [CCActionRemove action];
  [projectile runAction:[CCActionSequence actionWithArray:@[actionMove,actionRemove]]];
  
  [[OALSimpleAudio sharedInstance] playEffect:@"pew-pew-lei.caf"];
  
  }
  </code></pre>