powerup init commit
This commit is contained in:
@@ -42,6 +42,8 @@ add_executable(LotoStatek main.cpp
|
|||||||
sources/Beam.cpp
|
sources/Beam.cpp
|
||||||
headers/Heart.hpp
|
headers/Heart.hpp
|
||||||
sources/Heart.cpp
|
sources/Heart.cpp
|
||||||
|
headers/PowerUp.h
|
||||||
|
sources/PowerUp.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
9
headers/PowerUp.h
Normal file
9
headers/PowerUp.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef POWERUP_H
|
||||||
|
#define POWERUP_H
|
||||||
|
#include "ObjectItem.hpp"
|
||||||
|
|
||||||
|
class PowerUp : ObjectItem {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //POWERUP_H
|
||||||
@@ -111,13 +111,13 @@ void Plansza::update() {
|
|||||||
ship->update(); // migotanie statku
|
ship->update(); // migotanie statku
|
||||||
update_score(); // naliczanie punktów
|
update_score(); // naliczanie punktów
|
||||||
// Sprawnowanie wszystkich rodzajów wrogów
|
// Sprawnowanie wszystkich rodzajów wrogów
|
||||||
// spawn_meteor();
|
spawn_meteor();
|
||||||
// spawn_hearts();
|
spawn_hearts();
|
||||||
// spawn_enemy();
|
spawn_enemy();
|
||||||
// spawn_advanced_enemy();
|
spawn_advanced_enemy();
|
||||||
spawn_wiazkowiec();
|
spawn_wiazkowiec();
|
||||||
// spawn_bomber();
|
spawn_bomber();
|
||||||
// spawn_kamikadze();
|
spawn_kamikadze();
|
||||||
|
|
||||||
// utrzymanie meteorów i pocisków w ruchu
|
// utrzymanie meteorów i pocisków w ruchu
|
||||||
for (auto &meteor: meteors) {
|
for (auto &meteor: meteors) {
|
||||||
@@ -697,7 +697,6 @@ void Plansza::update() {
|
|||||||
}
|
}
|
||||||
// Meteor-related niżej
|
// Meteor-related niżej
|
||||||
|
|
||||||
|
|
||||||
void Plansza::update_meteors() {
|
void Plansza::update_meteors() {
|
||||||
// usuwanie meteorów, które wyleciały poza ekran
|
// usuwanie meteorów, które wyleciały poza ekran
|
||||||
for (auto &meteor: meteors) {
|
for (auto &meteor: meteors) {
|
||||||
@@ -721,14 +720,23 @@ void Plansza::spawn_meteor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Plansza::spawn_hearts() {
|
void Plansza::spawn_hearts() {
|
||||||
if (heartSpawnClock.getElapsedTime().asSeconds() > rand() % 26 + 5) { // randomowy spawn meteorytów od 5 do 30 sekundy
|
if (heartSpawnClock.getElapsedTime().asSeconds() > rand() % 26 + 5) { // randomowy spawn serduszek od 5 do 30 sekundy
|
||||||
if (hearts.size() < 5) { // jeśli jest mniej niż 5 meteorów na planszy
|
if (hearts.size() < 5) { // jeśli jest mniej niż 5 serduszek na planszy
|
||||||
hearts.emplace_back(RandomNumberGenerator::getRandomNumber(50, 499), -100, heartTexture);
|
hearts.emplace_back(RandomNumberGenerator::getRandomNumber(50, 499), -100, heartTexture);
|
||||||
}
|
}
|
||||||
heartSpawnClock.restart();
|
heartSpawnClock.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plansza::update_hearts() {
|
||||||
|
// usuwanie serduszek, które wyleciały poza ekran
|
||||||
|
for (auto& heart : hearts) {
|
||||||
|
if(heart.getStatus()) {
|
||||||
|
hearts.erase(hearts.begin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Plansza::spawn_player() {
|
void Plansza::spawn_player() {
|
||||||
ship = Player::getInstance(static_cast<int>(window->getSize().x) / 2, static_cast<int>(window->getSize().y) - 100, this->playerTexture);
|
ship = Player::getInstance(static_cast<int>(window->getSize().x) / 2, static_cast<int>(window->getSize().y) - 100, this->playerTexture);
|
||||||
ship->loadTexture();
|
ship->loadTexture();
|
||||||
@@ -776,7 +784,7 @@ void Plansza::spawn_kamikadze() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Plansza::spawn_wiazkowiec() {
|
void Plansza::spawn_wiazkowiec() {
|
||||||
if (WiazkowiecSpawnClock.getElapsedTime().asSeconds() >= 5) { // Spawn co 10 sekund
|
if (WiazkowiecSpawnClock.getElapsedTime().asSeconds() >= 50) { // Spawn co 10 sekund
|
||||||
if (WEnemies.size() < 1) {
|
if (WEnemies.size() < 1) {
|
||||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||||
Wiazkowiec wiazkowiec(spawnX, -50, WiazkowiecTexture, window);
|
Wiazkowiec wiazkowiec(spawnX, -50, WiazkowiecTexture, window);
|
||||||
@@ -788,16 +796,6 @@ void Plansza::spawn_wiazkowiec() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Plansza::update_hearts() {
|
|
||||||
// usuwanie serduszek, które wyleciały poza ekran
|
|
||||||
for (auto& heart : hearts) {
|
|
||||||
if(heart.getStatus()) {
|
|
||||||
hearts.erase(hearts.begin());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Size Plansza::getSize() {
|
Size Plansza::getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|||||||
1
sources/PowerUp.cpp
Normal file
1
sources/PowerUp.cpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#include "../headers/PowerUp.h"
|
||||||
Reference in New Issue
Block a user