Archived
Dodane regulacja prędkości i płynejsze poruszanie się
This commit is contained in:
+4
-6
@@ -30,12 +30,10 @@ public:
|
||||
|
||||
std::vector<Bullet>& getBullets();
|
||||
|
||||
void updateBullets() {
|
||||
for (auto& bullet : bullets) {
|
||||
if(bullet.getStatus()) {
|
||||
bullets.erase(bullets.begin());
|
||||
}
|
||||
}
|
||||
void updateBullets();
|
||||
|
||||
void setMovingSpeed(float speed) {
|
||||
moving_speed = speed;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
+2
-4
@@ -1,9 +1,9 @@
|
||||
#ifndef LOTOSTATEK_BULLET_H
|
||||
#define LOTOSTATEK_BULLET_H
|
||||
|
||||
|
||||
#include "SFML/Graphics/Sprite.hpp"
|
||||
#include "SFML/Graphics/Texture.hpp"
|
||||
|
||||
class Bullet {
|
||||
struct Position {
|
||||
int x;
|
||||
@@ -15,9 +15,7 @@ public:
|
||||
void update();
|
||||
sf::Sprite& getSprite();
|
||||
void setSpeed(float speed);
|
||||
bool getStatus() const {
|
||||
return outOfBounds;
|
||||
}
|
||||
bool getStatus() const;
|
||||
private:
|
||||
sf::Sprite bulletSprite;
|
||||
sf::Texture bulletTexture;
|
||||
|
||||
+8
-1
@@ -7,8 +7,15 @@
|
||||
class Player : public Actor {
|
||||
public:
|
||||
Player(int x, int y, std::string path);
|
||||
void shoot();
|
||||
void setFirerate(unsigned int firerate);
|
||||
void move(float deltaX, float deltaY);
|
||||
void moveLeft();
|
||||
void moveRight();
|
||||
void moveUp();
|
||||
void moveDown();
|
||||
private:
|
||||
|
||||
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user