Serduszka działają

do zrobienia jeszcze animacja uderzenia się w meteoryt (miganie) i wybuch statku przy uderzeniu się w meteoryt po raz trzeci
This commit is contained in:
2024-12-06 12:24:39 +01:00
parent 3b637508e1
commit 2f9e0ba236
6 changed files with 213 additions and 138 deletions

View File

@@ -5,6 +5,7 @@
#include "SFML/Graphics/Texture.hpp"
#include "Bullet.h"
#include "Position.h"
#include "SFML/System/Clock.hpp"
class Actor {
@@ -14,8 +15,9 @@ public:
void loadTexture(std::string path);
sf::Sprite& getSprite();
unsigned int getHP();
Position getPosition();
std::vector<Bullet>& getBullets();
virtual void move(float deltaX, float deltaY) = 0;
virtual void moveLeft() = 0;
@@ -24,19 +26,19 @@ public:
virtual void moveDown() = 0;
virtual void shoot() = 0;
std::vector<Bullet>& getBullets();
void updateBullets();
void setMovingSpeed(float speed);
void dealDamage();
void healUP();
protected:
sf::Sprite actorSprite;
sf::Texture actorTexture;
sf::Texture bulletTextureLeft;
sf::Texture bulletTextureRight;
sf::Clock damageDealClock;
Position position;
unsigned int hp;
int hp;
unsigned int damage;
unsigned int firerate;
float moving_speed;

View File

@@ -25,19 +25,21 @@ public:
void update_hearts();
void update();
private:
Size size;
sf::RenderWindow *window;
Background background;
Player ship;
AudioManager audioManager;
Size size;
sf::Texture meteorTexture1;
sf::Texture meteorTexture2;
sf::Texture heartTexture;
sf::Texture heartTextureGray;
sf::Clock meteorSpawnClock;
sf::Clock heartSpawnClock;
std::vector<Meteor> meteors;
std::vector<Heart> hearts;
sf::RenderWindow *window;
std::vector<sf::Sprite> heartStats;
bool gameOver = false;
};
#endif //PLANSZA_H