This commit is contained in:
Wojtek 2024-02-08 04:54:48 +01:00
parent 1421b90c66
commit a49a76f8ef

View File

@ -244,9 +244,6 @@ void renderEnemies() {
}
void renderHeartsAndNitro() {
glUseProgram(programSprite);
for (const auto & heart : hearts) {
//if (heart->isAlive()) {
//spriteRenderer->DrawSprite(texture::heartTexture, heart->modelMatrix, programSprite);
//}
@ -266,7 +263,21 @@ void renderHeartsAndNitro() {
++it;
}
}
}
for (auto it = nitros.begin(); it != nitros.end();) {
Nitro* nitro = *it;
if (nitro->isAlive()) {
spriteRenderer->DrawSprite(texture::boosterTexture, nitro->modelMatrix, programSprite);
}
if (nitro->isCollected) {
spaceship->turboBoost();
it = nitros.erase(it);
}
else {
++it;
}
}
}
@ -461,13 +472,14 @@ void createEnemies() {
enemies.push_back(new Enemy(100.0f, 100.0f, randomModelMatrix, 1.0f, 8.0f));
if (j % 4 == 0) {
hearts.push_back(new Heart(glm::translate(randomModelMatrix, glm::vec3(6.f, 5.f, 25.f)), -5.0f));
hearts.push_back(new Heart(glm::translate(randomModelMatrix, glm::vec3(6.f, 5.f, 8.f)), -5.0f));
nitros.push_back(new Nitro(glm::translate(randomModelMatrix, glm::vec3(2.f, -9.f, 3.f)), 10.0f));
}
j = j + 1;
}
hearts.push_back(new Heart(glm::translate(glm::mat4(1.0f), glm::vec3(25.f, 20.f, 25.f)), 10.0f));
nitros.push_back(new Nitro(glm::translate(glm::mat4(1.0f), glm::vec3(20.f, 20.f, 25.f)), 10.0f));
//obiekty do ktorych bedzie sprawdzana kolizja dla pociskow enemy
gameEntities.push_back(spaceship);