summary refs log tree commit diff stats
path: root/src/components.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components.h')
-rw-r--r--src/components.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/components.h b/src/components.h index f421529..c66db47 100644 --- a/src/components.h +++ b/src/components.h
@@ -19,10 +19,10 @@ class UserMovementComponent : public Component {
19class PhysicsBodyComponent : public Component { 19class PhysicsBodyComponent : public Component {
20 public: 20 public:
21 void receive(Game& game, Entity& entity, const Message& msg); 21 void receive(Game& game, Entity& entity, const Message& msg);
22 void tick(Game& game, Entity& entity); 22 void tick(Game& game, Entity& entity, double dt);
23 void detectCollision(Game& game, Entity& entity, Entity& collider, std::pair<double, double> old_position); 23 void detectCollision(Game& game, Entity& entity, Entity& collider, std::pair<double, double> old_position);
24 24
25 private: 25 protected:
26 std::pair<double, double> velocity; 26 std::pair<double, double> velocity;
27 std::pair<double, double> accel; 27 std::pair<double, double> accel;
28}; 28};
@@ -40,15 +40,13 @@ class PlayerSpriteComponent : public Component {
40 bool dying = false; 40 bool dying = false;
41}; 41};
42 42
43class PlayerPhysicsComponent : public Component { 43class PlayerPhysicsComponent : public PhysicsBodyComponent {
44 public: 44 public:
45 PlayerPhysicsComponent(); 45 PlayerPhysicsComponent();
46 void tick(Game& game, Entity& entity); 46 void tick(Game& game, Entity& entity, double dt);
47 void receive(Game& game, Entity& entity, const Message& msg); 47 void receive(Game& game, Entity& entity, const Message& msg);
48 48
49 private: 49 private:
50 std::pair<double, double> velocity;
51 std::pair<double, double> accel;
52 double jump_velocity; 50 double jump_velocity;
53 double jump_gravity; 51 double jump_gravity;
54 double jump_gravity_short; 52 double jump_gravity_short;