hearts #20

Merged
s464983 merged 3 commits from hearts into master 2024-02-08 05:10:34 +01:00
Showing only changes of commit a49a76f8ef - Show all commits

View File

@ -244,9 +244,6 @@ void renderEnemies() {
} }
void renderHeartsAndNitro() { void renderHeartsAndNitro() {
glUseProgram(programSprite);
for (const auto & heart : hearts) {
//if (heart->isAlive()) { //if (heart->isAlive()) {
//spriteRenderer->DrawSprite(texture::heartTexture, heart->modelMatrix, programSprite); //spriteRenderer->DrawSprite(texture::heartTexture, heart->modelMatrix, programSprite);
//} //}
@ -266,7 +263,21 @@ void renderHeartsAndNitro() {
++it; ++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)); enemies.push_back(new Enemy(100.0f, 100.0f, randomModelMatrix, 1.0f, 8.0f));
if (j % 4 == 0) { 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; j = j + 1;
} }
hearts.push_back(new Heart(glm::translate(glm::mat4(1.0f), glm::vec3(25.f, 20.f, 25.f)), 10.0f)); 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 //obiekty do ktorych bedzie sprawdzana kolizja dla pociskow enemy
gameEntities.push_back(spaceship); gameEntities.push_back(spaceship);