Compare commits
34 Commits
0e1b53fc9b
...
5Przeciwni
| Author | SHA1 | Date | |
|---|---|---|---|
| 87399213b3 | |||
| f1dc19e795 | |||
| 168ba2e477 | |||
| 38fd71b8e6 | |||
| 1c0e5d0293 | |||
| c898aa0d81 | |||
| b257837d18 | |||
| 17c372fad9 | |||
| 0c706625d2 | |||
| c1a24a701b | |||
| 41945b3d88 | |||
| 2234e4d973 | |||
| 81b04bae0f | |||
| 77eb83c2c3 | |||
| a81cf284d0 | |||
| 13066709a7 | |||
| 44f4556fda | |||
| c655409596 | |||
| e2e44ff1ba | |||
| b6830c305b | |||
| 087a8d7672 | |||
| 9d4af21d4d | |||
| 5eda245ccc | |||
| 72e2116dc7 | |||
| 7ecb90af1f | |||
| 29d3c11fd1 | |||
| 5ccb29f27b | |||
| 2341c2fa6d | |||
| 2f6c98f4be | |||
| d20fb3043b | |||
| fec3de86d3 | |||
| c7dbca9eb3 | |||
| 559d946cab | |||
| 6996490f3c |
@@ -19,14 +19,35 @@ add_executable(LotoStatek main.cpp
|
||||
sources/Bullet.cpp
|
||||
headers/Meteor.h
|
||||
sources/Meteor.cpp
|
||||
headers/RandomNumberGenerator.h)
|
||||
headers/RandomNumberGenerator.h
|
||||
headers/Projectile.h
|
||||
sources/Projectile.cpp
|
||||
headers/Rocket.h
|
||||
sources/Rocket.cpp
|
||||
headers/Size.h
|
||||
headers/Position.h
|
||||
headers/ObjectItem.hpp
|
||||
sources/ObjectItem.cpp
|
||||
sources/Enemy.cpp
|
||||
headers/Enemy.h
|
||||
headers/AdvancedEnemy.h
|
||||
sources/AdvancedEnemy.cpp
|
||||
headers/Bomber.h
|
||||
sources/Bomber.cpp
|
||||
headers/Kamikadze.h
|
||||
sources/Kamikadze.cpp
|
||||
headers/wiazkowiec.h
|
||||
sources/Wiazkowiec.cpp
|
||||
headers/Beam.h
|
||||
sources/Beam.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(SFML_ROOT "${CMAKE_SOURCE_DIR}/SFML")
|
||||
set(SFML_ROOT "${CMAKE_SOURCE_DIR}/lib/SFML")
|
||||
# set(SFML_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/SFML/include")
|
||||
file(GLOB BINARY_DEP_DLLS "${SFML_INCLUDE_DIR}/../bin/*.dll")
|
||||
file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
include_directories("${CMAKE_SOURCE_DIR}/SFML/bin" "${CMAKE_SOURCE_DIR}/SFML/include" "${CMAKE_SOURCE_DIR}/SFML/lib/cmake/SFML") # dodane
|
||||
include_directories("${CMAKE_SOURCE_DIR}/lib/SFML/bin" "${CMAKE_SOURCE_DIR}/lib/SFML/include" "${CMAKE_SOURCE_DIR}/lib/SFML/lib/cmake/SFML") # dodane
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules") # dodane
|
||||
find_package(SFML 2.6.2 COMPONENTS graphics window system audio REQUIRED)
|
||||
if(SFML_FOUND)
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
BIN
assets/img/bullets/bomba.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
assets/img/bullets/enemy_bullet.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
assets/img/enemy/advanced_enemy.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
assets/img/enemy/bomber.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/img/enemy/enemy.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/img/enemy/kamikadze.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/img/enemy/wiazkowiec.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
assets/img/hearts/heart.png
Normal file
|
After Width: | Height: | Size: 782 B |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 667 KiB After Width: | Height: | Size: 667 KiB |
|
Before Width: | Height: | Size: 402 KiB After Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
BIN
assets/img/wiazka/wiazka.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
@@ -4,15 +4,12 @@
|
||||
#include "SFML/Graphics/Sprite.hpp"
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
#include "Bullet.h"
|
||||
#include "Position.h"
|
||||
|
||||
struct Position {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
class Actor {
|
||||
public:
|
||||
Actor(int x, int y, std::string path);
|
||||
Actor(int x, int y, const sf::Texture& texture);
|
||||
|
||||
void loadTexture(std::string path);
|
||||
|
||||
|
||||
39
headers/AdvancedEnemy.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef ADVANCED_ENEMY_H
|
||||
#define ADVANCED_ENEMY_H
|
||||
|
||||
#include "Enemy.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
enum class DirectionA {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
class AdvancedEnemy : public Actor {
|
||||
public:
|
||||
AdvancedEnemy(int x, int y, const sf::Texture& texture, const sf::Texture& bulletTexture);
|
||||
|
||||
void shoot() override;
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
|
||||
void update();
|
||||
|
||||
bool isAlive() const;
|
||||
void takeDamage();
|
||||
void updateDirection();
|
||||
|
||||
private:
|
||||
sf::Clock shootClock;
|
||||
sf::Texture enemyBulletTexture;
|
||||
float movementSpeed = 2.0f;
|
||||
bool alive = true;
|
||||
DirectionA direction = DirectionA::Down;
|
||||
};
|
||||
#endif // ADVANCED_ENEMY_H
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
class AudioManager {
|
||||
public:
|
||||
AudioManager() = default;
|
||||
bool loadBackgroundMusic(const std::string& filePath);
|
||||
void playBackgroundMusic(float volume = 50.f, bool loop = true);
|
||||
void stopBackgroundMusic();
|
||||
|
||||
29
headers/Beam.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef LOTOSTATEK_BEAM_H
|
||||
#define LOTOSTATEK_BEAM_H
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "Position.h"
|
||||
|
||||
class Beam {
|
||||
public:
|
||||
Beam(float x, float y, float width, float height, const sf::Color& color);
|
||||
|
||||
void draw(sf::RenderWindow &window);
|
||||
|
||||
void update();
|
||||
void render(sf::RenderWindow& window);
|
||||
|
||||
sf::FloatRect getBounds() const;
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
|
||||
private:
|
||||
sf::RectangleShape beamShape;
|
||||
bool visible;
|
||||
sf::Texture beamTexture;
|
||||
sf::Sprite beamSprite;
|
||||
};
|
||||
|
||||
#endif // LOTOSTATEK_BEAM_H
|
||||
45
headers/Bomber.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Created by k on 11.12.2024.
|
||||
//
|
||||
|
||||
#ifndef BOMBER_H
|
||||
#define BOMBER_H
|
||||
|
||||
#include "Enemy.h"
|
||||
#include "Actor.h"
|
||||
enum class DirectionB {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
class Bomber : public Actor {
|
||||
public:
|
||||
Bomber(int x, int y, const sf::Texture& texture, const sf::Texture& bulletTexture);
|
||||
|
||||
void shoot() override;
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
void setRandomDirection();
|
||||
|
||||
void update();
|
||||
|
||||
bool isAlive() const;
|
||||
void takeDamage();
|
||||
void updateDirection();
|
||||
void setPlanszaHeight(float height, float width);
|
||||
|
||||
private:
|
||||
float planszaHeight = 800.f;
|
||||
float planszaWidth = 600.f;
|
||||
sf::Clock shootClock;
|
||||
sf::Texture BombaTexture;
|
||||
float movementSpeed = 2.0f;
|
||||
bool alive = true;
|
||||
DirectionB direction = DirectionB::Down;
|
||||
};
|
||||
#endif //BOMBER_H
|
||||
@@ -1,27 +1,15 @@
|
||||
#ifndef LOTOSTATEK_BULLET_H
|
||||
#define LOTOSTATEK_BULLET_H
|
||||
|
||||
#include "SFML/Graphics/Sprite.hpp"
|
||||
#include "Projectile.h"
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
|
||||
class Bullet {
|
||||
struct Position {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
class Bullet : public Projectile {
|
||||
public:
|
||||
Bullet(float x, float y, sf::Texture &texture);
|
||||
sf::Sprite &getSprite();
|
||||
void setSpeed(float speed);
|
||||
bool getStatus() const;
|
||||
void update();
|
||||
Bullet(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {};
|
||||
void update() override;
|
||||
private:
|
||||
sf::Sprite bulletSprite;
|
||||
sf::Texture bulletTexture;
|
||||
Position bulletPosition;
|
||||
float bulletSpeed;
|
||||
bool outOfBounds;
|
||||
float directionY;
|
||||
};
|
||||
|
||||
|
||||
|
||||
39
headers/Enemy.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef ENEMY_H
|
||||
#define ENEMY_H
|
||||
|
||||
#include "Actor.h"
|
||||
#include "SFML/System/Clock.hpp"
|
||||
|
||||
enum class Direction {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
class Enemy : public Actor {
|
||||
public:
|
||||
Enemy(int x, int y, const sf::Texture& texture) ;
|
||||
|
||||
void shoot() override;
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
|
||||
void update();
|
||||
|
||||
bool isAlive() const;
|
||||
void takeDamage();
|
||||
void updateDirection();
|
||||
|
||||
private:
|
||||
sf::Clock shootClock;
|
||||
sf::Texture enemyBulletTexture;
|
||||
float movementSpeed = 2.0f;
|
||||
bool alive = true;
|
||||
Direction direction = Direction::Down;
|
||||
};
|
||||
|
||||
#endif // ENEMY_H
|
||||
46
headers/Kamikadze.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef KAMIKADZE_H
|
||||
#define KAMIKADZE_H
|
||||
|
||||
#include "Enemy.h"
|
||||
#include "Actor.h"
|
||||
#include "Player.h"
|
||||
enum class DirectionK {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
class Kamikadze : public Actor {
|
||||
public:
|
||||
Kamikadze(int x, int y, const sf::Texture& texture);
|
||||
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
void setRandomDirection();
|
||||
void shoot() override;
|
||||
|
||||
void update(const sf::Vector2f& playerPosition);
|
||||
|
||||
bool isAlive() const;
|
||||
bool isExploding() const;
|
||||
void takeDamage();
|
||||
void updateDirection();
|
||||
|
||||
void followPlayer(const sf::Vector2f &playerPosition);
|
||||
|
||||
void explode(const sf::Vector2f &playerPosition, bool &playerHit);
|
||||
|
||||
private:
|
||||
bool exploding = false;
|
||||
sf::Clock explosionClock;
|
||||
sf::Clock shootClock;
|
||||
float movementSpeed = 2.0f;
|
||||
bool alive = true;
|
||||
DirectionK direction = DirectionK::Down;
|
||||
};
|
||||
|
||||
#endif //KAMIKADZE_H
|
||||
@@ -3,27 +3,13 @@
|
||||
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
#include "SFML/Graphics/Sprite.hpp"
|
||||
#include "Position.h"
|
||||
#include "ObjectItem.hpp"
|
||||
|
||||
class Meteor {
|
||||
struct Position {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
class Meteor : public ObjectItem {
|
||||
public:
|
||||
Meteor(float x, float y, sf::Texture &texture);
|
||||
sf::Sprite &getSprite();
|
||||
bool getStatus();
|
||||
void update();
|
||||
// ~Meteor();
|
||||
private:
|
||||
sf::Texture meteorTexture;
|
||||
sf::Sprite meteorSprite;
|
||||
Position meteorPosition;
|
||||
float meteorRotationSpeed;
|
||||
float meteorSpeed;
|
||||
bool outOfBounds;
|
||||
static unsigned int counter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
24
headers/ObjectItem.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef LOTOSTATEK_OBJECTITEM_HPP
|
||||
#define LOTOSTATEK_OBJECTITEM_HPP
|
||||
|
||||
#include "SFML/Graphics/Sprite.hpp"
|
||||
#include "Position.h"
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
|
||||
class ObjectItem {
|
||||
public:
|
||||
ObjectItem(float x, float y, sf::Texture &texture);
|
||||
sf::Sprite &getSprite();
|
||||
bool getStatus();
|
||||
virtual void update() = 0;
|
||||
protected:
|
||||
sf::Texture texture;
|
||||
sf::Sprite sprite;
|
||||
Position position;
|
||||
float rotationSpeed;
|
||||
float movingSpeed;
|
||||
bool outOfBounds;
|
||||
static unsigned int counter;
|
||||
};
|
||||
|
||||
#endif //LOTOSTATEK_OBJECTITEM_HPP
|
||||
@@ -1,28 +1,75 @@
|
||||
#ifndef PLANSZA_H
|
||||
#define PLANSZA_H
|
||||
|
||||
|
||||
#include "Meteor.h"
|
||||
#include "Enemy.h"
|
||||
#include "AdvancedEnemy.h"
|
||||
#include "Bomber.h"
|
||||
#include "Kamikadze.h"
|
||||
#include "Wiazkowiec.h"
|
||||
#include "Beam.h"
|
||||
#include "RandomNumberGenerator.h"
|
||||
#include "SFML/System/Clock.hpp"
|
||||
#include "SFML/Graphics/RenderWindow.hpp"
|
||||
#include "Size.h"
|
||||
#include <memory>
|
||||
|
||||
#include "Player.h"
|
||||
#include "Background.h"
|
||||
#include "AudioManager.h"
|
||||
#include "Meteor.h"
|
||||
#include "Plansza.h"
|
||||
|
||||
class Plansza {
|
||||
struct Size {
|
||||
int height;
|
||||
int width;
|
||||
};
|
||||
public:
|
||||
Plansza(unsigned int windowHeight, unsigned int windowWidth);
|
||||
void spawn_meteor();
|
||||
Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow,
|
||||
const sf::Texture& playerTexture, const sf::Texture& playerBulletTexture, const sf::Texture& playerRocketTexture);
|
||||
Size getSize();
|
||||
std::vector<Meteor> &getMeteors();
|
||||
|
||||
|
||||
void spawn_meteor();
|
||||
void update_meteors();
|
||||
void update();
|
||||
void spawn_enemy();
|
||||
void setOutOfBounds(bool status);
|
||||
void spawn_advanced_enemy();
|
||||
void spawn_wiazkowiec();
|
||||
void spawn_bomber();
|
||||
void spawn_kamikadze();
|
||||
|
||||
private:
|
||||
std::vector<Meteor> meteors;
|
||||
Size size;
|
||||
Background background;
|
||||
Player ship;
|
||||
AudioManager audioManager;
|
||||
sf::Texture meteorTexture1;
|
||||
sf::Texture meteorTexture2;
|
||||
sf::Texture enemyBulletTexture;
|
||||
sf::Texture WiazkaTexture;
|
||||
sf::Texture BombaTexture;
|
||||
sf::Texture playerTexture;
|
||||
sf::Texture playerBulletTexture;
|
||||
sf::Texture playerRocketTexture;
|
||||
sf::Texture enemyTexture;
|
||||
sf::Texture advancedEnemyTexture;
|
||||
sf::Texture BomberEnemyTexture;
|
||||
sf::Texture KamikadzeTexture;
|
||||
sf::Texture WiazkowiecTexture;
|
||||
sf::Clock spawnClock;
|
||||
sf::Clock shooterSpawnClock;
|
||||
std::vector<Enemy> enemies;
|
||||
std::vector<AdvancedEnemy> AEnemies;
|
||||
std::vector<Bomber> BEnemies;
|
||||
std::vector<Kamikadze> KEnemies;
|
||||
std::vector<Wiazkowiec> WEnemies;
|
||||
sf::Clock enemySpawnClock;
|
||||
sf::Clock AenemySpawnClock;
|
||||
sf::Clock BomberSpawnClock;
|
||||
sf::Clock KamikadzeSpawnClock;
|
||||
sf::Clock WiazkowiecSpawnClock;
|
||||
std::vector<Meteor> meteors;
|
||||
sf::RenderWindow *window;
|
||||
};
|
||||
|
||||
#endif //PLANSZA_H
|
||||
|
||||
@@ -3,11 +3,15 @@
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <SFML/System/Clock.hpp>
|
||||
|
||||
#include "Actor.h"
|
||||
#include "Rocket.h"
|
||||
|
||||
class Player : public Actor {
|
||||
public:
|
||||
Player(int x, int y, std::string path);
|
||||
Player(int x, int y, const sf::Texture& texture, const sf::Texture& bulletTexture, const sf::Texture& rocketTexture);
|
||||
void setTextures(const sf::Texture& shipTexture, const sf::Texture& bulletTexture, const sf::Texture& rocketTexture);
|
||||
void shoot() override;
|
||||
void alternate_shoot();
|
||||
void setFirerate(unsigned int firerate);
|
||||
@@ -16,10 +20,19 @@ public:
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
void takeDamage();
|
||||
bool isAlive() const;
|
||||
void update();
|
||||
std::vector<Rocket>& getRockets();
|
||||
private:
|
||||
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
||||
std::vector<Bullet> rightBullets;
|
||||
|
||||
std::vector<Rocket> rockets;
|
||||
sf::Texture rocketTexture;
|
||||
int health = 3; // Liczba punktów życia gracza
|
||||
sf::Texture bulletTexture;
|
||||
bool isImmortal = false; // flaga na immortal
|
||||
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
|
||||
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec
|
||||
};
|
||||
|
||||
|
||||
|
||||
9
headers/Position.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef LOTOSTATEK_POSITION_H
|
||||
#define LOTOSTATEK_POSITION_H
|
||||
|
||||
struct Position {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
#endif //LOTOSTATEK_POSITION_H
|
||||
23
headers/Projectile.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef PROJECTILE_H
|
||||
#define PROJECTILE_H
|
||||
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include "Position.h"
|
||||
|
||||
class Projectile {
|
||||
public:
|
||||
Projectile(float x, float y, sf::Texture &texture);
|
||||
sf::Sprite &getSprite();
|
||||
void setSpeed(float speed);
|
||||
bool isOutOfBounds() const;
|
||||
virtual void update() = 0;
|
||||
protected:
|
||||
static sf::Texture texture;
|
||||
sf::Sprite sprite;
|
||||
Position position;
|
||||
float speed;
|
||||
bool outOfBounds;
|
||||
~Projectile() = default;
|
||||
};
|
||||
|
||||
#endif //PROJECTILE_H
|
||||
15
headers/Rocket.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef ROCKET_H
|
||||
#define ROCKET_H
|
||||
#include "Projectile.h"
|
||||
|
||||
|
||||
class Rocket : public Projectile{
|
||||
public:
|
||||
Rocket(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {};
|
||||
void update() override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //ROCKET_H
|
||||
9
headers/Size.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef LOTOSTATEK_SIZE_H
|
||||
#define LOTOSTATEK_SIZE_H
|
||||
|
||||
struct Size {
|
||||
int height;
|
||||
int width;
|
||||
};
|
||||
|
||||
#endif //LOTOSTATEK_SIZE_H
|
||||
54
headers/Wiazkowiec.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef WIAZKOWIEC_H
|
||||
#define WIAZKOWIEC_H
|
||||
|
||||
#include "Enemy.h"
|
||||
#include "Actor.h"
|
||||
#include "Beam.h"
|
||||
enum class DirectionW {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
class Wiazkowiec : public Actor {
|
||||
public:
|
||||
Wiazkowiec(int x, int y, const sf::Texture& texture);
|
||||
|
||||
void shoot() override;
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
void setRandomDirection();
|
||||
|
||||
void update();
|
||||
|
||||
void render(sf::RenderWindow &window);
|
||||
|
||||
bool isAlive() const;
|
||||
void takeDamage();
|
||||
void updateDirection();
|
||||
bool isShooting() const;
|
||||
const Beam& getBeam() const;
|
||||
void setPlanszaHeight(float height, float width);
|
||||
void setMapBounds(float width, float height);
|
||||
|
||||
|
||||
private:
|
||||
float planszaHeight = 800.f;
|
||||
float planszaWidth = 600.f;
|
||||
sf::Clock shootClock;
|
||||
sf::Texture WiazkaTexture;
|
||||
float movementSpeed = 2.0f;
|
||||
bool alive = true;
|
||||
DirectionW direction = DirectionW::Down;
|
||||
Beam beam; // Wiązka
|
||||
bool shooting = false;
|
||||
sf::Clock shootingClock;
|
||||
float beamDuration = 1.0f;
|
||||
void spawnBeam(); // Tworzy wiązkę
|
||||
};
|
||||
|
||||
#endif //WIAZKOWIEC_H
|
||||