void Player::updateBullets(const std::function& create) { stopActionByTag(SHOOT_TAG); for (int i = 0; i < _numBullets; i++){ _parent->removeChild(_bulletPool.at(i), true); auto bullet = create(); bullet->setPlayerTargets(_targets); _bulletPool.replace(i, bullet); _parent->addChild(_bulletPool.at(i), getLocalZOrder()); } runAction(_shoot); }