Merge remote-tracking branch 'origin/serduszka'
# Conflicts: # CMakeLists.txt # headers/Actor.h # headers/Plansza.h # headers/Player.h # sources/Plansza.cpp # sources/Player.cpp
This commit is contained in:
@@ -5,12 +5,20 @@
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
#include "Bullet.h"
|
||||
#include "Position.h"
|
||||
#include "SFML/System/Clock.hpp"
|
||||
|
||||
|
||||
class Actor {
|
||||
public:
|
||||
Actor(int x, int y, const sf::Texture& texture);
|
||||
|
||||
|
||||
|
||||
sf::Sprite& getSprite();
|
||||
unsigned int getHP();
|
||||
Position getPosition();
|
||||
std::vector<Bullet>& getBullets();
|
||||
|
||||
virtual void move(float deltaX, float deltaY) = 0;
|
||||
virtual void moveLeft() = 0;
|
||||
virtual void moveRight() = 0;
|
||||
@@ -21,8 +29,10 @@ public:
|
||||
std::vector<Bullet>& getBullets();
|
||||
sf::Sprite& getSprite();
|
||||
Position getPosition();
|
||||
|
||||
void updateBullets();
|
||||
void setMovingSpeed(float speed);
|
||||
void dealDamage();
|
||||
void healUP();
|
||||
|
||||
void updateBullets();
|
||||
|
||||
@@ -33,7 +43,9 @@ protected:
|
||||
sf::Texture bulletTexture;
|
||||
sf::Texture rocketTexture;
|
||||
std::vector<Bullet> bullets;
|
||||
unsigned int hp;
|
||||
sf::Clock damageDealClock;
|
||||
Position position;
|
||||
int hp;
|
||||
unsigned int damage;
|
||||
unsigned int firerate;
|
||||
float moving_speed;
|
||||
|
||||
14
headers/Heart.hpp
Normal file
14
headers/Heart.hpp
Normal 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
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "Background.h"
|
||||
#include "AudioManager.h"
|
||||
#include "Plansza.h"
|
||||
#include "Heart.hpp"
|
||||
#include "Size.h"
|
||||
|
||||
class Plansza {
|
||||
@@ -22,7 +23,9 @@ public:
|
||||
Size getSize();
|
||||
std::vector<Meteor> &getMeteors();
|
||||
void spawn_meteor();
|
||||
void spawn_hearts();
|
||||
void update_meteors();
|
||||
void update_hearts();
|
||||
void update();
|
||||
void update_score();
|
||||
void setOutOfBounds(bool status);
|
||||
@@ -36,14 +39,19 @@ public:
|
||||
delete ship; // usuwanie wskaźnika ship
|
||||
}
|
||||
private:
|
||||
Size size;
|
||||
sf::RenderWindow *window;
|
||||
Background background;
|
||||
AudioManager audioManager;
|
||||
Player *ship;
|
||||
sf::RenderWindow *window;
|
||||
sf::Font font;
|
||||
Size size;
|
||||
sf::Texture meteorTexture1;
|
||||
sf::Texture meteorTexture2;
|
||||
sf::Texture heartTexture;
|
||||
sf::Texture heartTextureGray;
|
||||
sf::Clock meteorSpawnClock;
|
||||
sf::Clock heartSpawnClock;
|
||||
sf::Texture enemyBulletTexture;
|
||||
sf::Texture WiazkaTexture;
|
||||
sf::Texture BombaTexture;
|
||||
@@ -69,6 +77,9 @@ private:
|
||||
std::vector<Kamikadze> KEnemies;
|
||||
std::vector<Wiazkowiec> WEnemies;
|
||||
std::vector<Meteor> meteors;
|
||||
std::vector<Heart> hearts;
|
||||
std::vector<sf::Sprite> heartStats;
|
||||
bool gameOver = false;
|
||||
unsigned int score = 0;
|
||||
bool isPlayerSpawned = false;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef LOTOSTATEK_PLAYER_H
|
||||
#define LOTOSTATEK_PLAYER_H
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <SFML/System/Clock.hpp>
|
||||
|
||||
@@ -30,6 +31,8 @@ public:
|
||||
void takeDamage();
|
||||
bool isAlive() const;
|
||||
void update();
|
||||
void onHit();
|
||||
void update();
|
||||
std::vector<Rocket>& getRockets();
|
||||
|
||||
void loadTexture();
|
||||
@@ -39,6 +42,9 @@ private:
|
||||
std::vector<Rocket> rockets;
|
||||
sf::Texture rocketTexture;
|
||||
sf::Texture bulletTexture;
|
||||
bool isBlinking = false;
|
||||
sf::Color originalColor;
|
||||
|
||||
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
|
||||
int health = 3; // Liczba punktów życia gracza
|
||||
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec
|
||||
|
||||
Reference in New Issue
Block a user