Archived
A little code refactor
+ new bullet texture added
This commit is contained in:
+8
-8
@@ -20,13 +20,12 @@ public:
|
||||
|
||||
Position getPosition();
|
||||
|
||||
void move(float deltaX, float deltaY);
|
||||
|
||||
void moveLeft();
|
||||
|
||||
void moveRight();
|
||||
|
||||
void shoot();
|
||||
virtual void move(float deltaX, float deltaY) = 0;
|
||||
virtual void moveLeft() = 0;
|
||||
virtual void moveRight() = 0;
|
||||
virtual void moveUp() = 0;
|
||||
virtual void moveDown() = 0;
|
||||
virtual void shoot() = 0;
|
||||
|
||||
std::vector<Bullet>& getBullets();
|
||||
|
||||
@@ -39,7 +38,8 @@ public:
|
||||
protected:
|
||||
sf::Sprite actorSprite;
|
||||
sf::Texture actorTexture;
|
||||
sf::Texture bulletTexture;
|
||||
sf::Texture bulletTextureLeft;
|
||||
sf::Texture bulletTextureRight;
|
||||
Position position;
|
||||
unsigned int hp;
|
||||
unsigned int damage;
|
||||
|
||||
+6
-6
@@ -7,13 +7,13 @@
|
||||
class Player : public Actor {
|
||||
public:
|
||||
Player(int x, int y, std::string path);
|
||||
void shoot();
|
||||
void shoot() override;
|
||||
void setFirerate(unsigned int firerate);
|
||||
void move(float deltaX, float deltaY);
|
||||
void moveLeft();
|
||||
void moveRight();
|
||||
void moveUp();
|
||||
void moveDown();
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
void moveRight() override;
|
||||
void moveUp() override;
|
||||
void moveDown() override;
|
||||
private:
|
||||
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user