holesome/src/game/physics/holes/collectable_simulation.hpp

33 lines
755 B
C++
Raw Normal View History

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;
[[nodiscard]] std::shared_ptr<Collectable> getCollectable() const;
2023-06-28 16:57:13 +02:00
private:
std::shared_ptr<b2World> world;
b2Body* body;
std::shared_ptr<Collectable> collectable;
void updateGroundHole();
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