You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
693 B
31 lines
693 B
#ifndef FLOPPY_BIRD_BIRD_H
|
|
#define FLOPPY_BIRD_BIRD_H
|
|
|
|
#include <SFML/Graphics/Sprite.hpp>
|
|
#include <SFML/Graphics/Texture.hpp>
|
|
#include <SFML/Graphics/RenderTarget.hpp>
|
|
#include <memory>
|
|
|
|
const float gravity = 9.8;
|
|
|
|
class Bird : public sf::Drawable {
|
|
|
|
sf::Sprite sprite;
|
|
std::shared_ptr<std::vector<sf::Texture>> texture_list;
|
|
|
|
sf::Vector2f position;
|
|
float momentum;
|
|
|
|
public:
|
|
Bird(float x, float y, const std::shared_ptr<std::vector<sf::Texture>> texture_list);
|
|
|
|
void impulse(float p);
|
|
void tick(float step);
|
|
bool collides(sf::FloatRect bounds);
|
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
|
|
};
|
|
|
|
|
|
#endif //FLOPPY_BIRD_BIRD_H
|