void Game::updateBullet(double dt, vector<Node*>::iterator nodeIt) { Bullet* bullet = (Bullet*) (*nodeIt); // Move the bullet up bullet->translate(0.0f, dt * bullet->getSpeed()); // Mark it for deletion if it's out if (bullet->isOut()) { deleted_.push_back(nodeIt - scene_.begin()); } // Detect if bullet hit meteor for (vector<Node*>::iterator node = scene_.begin(); node < scene_.end(); ++node) { enum NodeType type = (*node)->getType(); // And if it hit... if ((type == METEOR || type == SMALL_METEOR) && bullet->isIntersect(*node)) { // Remove the bullet deleted_.push_back(nodeIt - scene_.begin()); // Remove the meteor deleted_.push_back(node - scene_.begin()); // And if it is a big one set flag to spawn small meteors if (type == METEOR) { Meteor* meteor = (Meteor*) (*node); smallMeteorX_ = meteor->getX(); smallMeteorY_ = meteor->getY(); score_++; } else { score_ += 2; } } } }