2023-06-28 16:57:13 +02:00
|
|
|
#ifndef HOLESOME_COLLECTABLE_SIMULATION_HPP
|
|
|
|
#define HOLESOME_COLLECTABLE_SIMULATION_HPP
|
|
|
|
|
|
|
|
|
|
|
|
#include <box2d/box2d.h>
|
|
|
|
#include "../../game_object.h"
|
|
|
|
#include "../../collectables/collectable.hpp"
|
|
|
|
|
|
|
|
class CollectableSimulation : public GameObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit CollectableSimulation(const std::shared_ptr<Collectable> &collectable);
|
|
|
|
|
|
|
|
void physicsUpdate() override;
|
|
|
|
|
|
|
|
std::shared_ptr<Collectable> getCollectable() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<b2World> world;
|
|
|
|
b2Body* body;
|
|
|
|
|
|
|
|
std::shared_ptr<Collectable> collectable;
|
|
|
|
|
|
|
|
void updateGroundHole();
|
2023-06-29 21:26:30 +02:00
|
|
|
|
|
|
|
void updateCollectable();
|
|
|
|
|
|
|
|
b2Body *addSquareBody(b2BodyType type, sf::Vector2f center, sf::Vector2f size);
|
2023-06-28 16:57:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //HOLESOME_COLLECTABLE_SIMULATION_HPP
|