1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #pragma once
- #include <SFML/Graphics.hpp>
- #include <SFML/Audio.hpp>
- #include "Collidable.hpp"
- class Bullet: public sf::Drawable, public sf::Transformable, public Collidable
- {
- public:
- Bullet() = delete;
- Bullet(float rotation, sf::Vector2f initialPosition, sf::SoundBuffer& buffer1, sf::SoundBuffer& buffer2, Foreground* foreground);
- void setTexture(sf::Texture& texture);
- void update(sf::Time delta, sf::Vector2f position);
- const bool isDead() const;
- private:
- sf::Vertex _vertex[4];
- const sf::Texture* _texture;
- virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
- void destroyPixels(int& k, int x, int y);
- sf::Sound _sound;
- sf::Sound _explosion;
- Foreground* _foreground;
- bool _hit;
- bool _dead;
- };
|