Added heart and spawn of them

This commit is contained in:
2024-12-05 14:52:00 +01:00
parent b6830c305b
commit 3b637508e1
5 changed files with 81 additions and 6 deletions

14
headers/Heart.hpp Normal file
View File

@@ -0,0 +1,14 @@
#ifndef LOTOSTATEK_HEART_HPP
#define LOTOSTATEK_HEART_HPP
#include "SFML/Graphics/Texture.hpp"
#include "SFML/Graphics/Sprite.hpp"
#include "ObjectItem.hpp"
class Heart : public ObjectItem {
public:
Heart(float x, float y, sf::Texture &texture);
void update();
};
#endif //LOTOSTATEK_HEART_HPP

View File

@@ -12,6 +12,7 @@
#include "AudioManager.h"
#include "Meteor.h"
#include "Plansza.h"
#include "Heart.hpp"
class Plansza {
public:
@@ -19,7 +20,9 @@ public:
Size getSize();
std::vector<Meteor> &getMeteors();
void spawn_meteor();
void spawn_hearts();
void update_meteors();
void update_hearts();
void update();
private:
Size size;
@@ -28,9 +31,13 @@ private:
AudioManager audioManager;
sf::Texture meteorTexture1;
sf::Texture meteorTexture2;
sf::Clock spawnClock;
sf::Texture heartTexture;
sf::Clock meteorSpawnClock;
sf::Clock heartSpawnClock;
std::vector<Meteor> meteors;
std::vector<Heart> hearts;
sf::RenderWindow *window;
};
#endif //PLANSZA_H