Niby strzela, ale bez kolizji
This commit is contained in:
@@ -8,6 +8,8 @@ class Bullet : public Projectile {
|
||||
public:
|
||||
Bullet(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {};
|
||||
void update() override;
|
||||
private:
|
||||
float directionY;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
#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, std::string path);
|
||||
@@ -14,12 +21,19 @@ public:
|
||||
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
|
||||
|
||||
14
headers/EnemyBullet.h
Normal file
14
headers/EnemyBullet.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef ENEMY_BULLET_H
|
||||
#define ENEMY_BULLET_H
|
||||
|
||||
#include "Projectile.h"
|
||||
|
||||
class EnemyBullet : public Projectile {
|
||||
public:
|
||||
EnemyBullet(float x, float y, sf::Texture &texture);
|
||||
void update() override;
|
||||
|
||||
void setOutOfBounds(bool status);
|
||||
};
|
||||
|
||||
#endif // ENEMY_BULLET_H
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
void update_meteors();
|
||||
void update();
|
||||
void spawn_enemy();
|
||||
void setOutOfBounds(bool status);
|
||||
private:
|
||||
Size size;
|
||||
Background background;
|
||||
|
||||
Reference in New Issue
Block a user