summary refs log tree commit diff stats
path: root/src/components/ponderable.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-02-12 16:39:49 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-02-12 16:39:49 -0500
commit5cc80ec58ea5bd66456f6f5286fa5f26d3fe702b (patch)
tree283cef0e95f237e70892e8b90c841f971cb61fd9 /src/components/ponderable.h
parent77be863f4f15d2481a64e4e8dadb4060a6e4e590 (diff)
downloadtherapy-5cc80ec58ea5bd66456f6f5286fa5f26d3fe702b.tar.gz
therapy-5cc80ec58ea5bd66456f6f5286fa5f26d3fe702b.tar.bz2
therapy-5cc80ec58ea5bd66456f6f5286fa5f26d3fe702b.zip
Abstracted behavior related to "orientable" entities
A lot of the stuff that ControllingSystem did to control the player character was moved into the new OrientingSystem. This is so that the player, or any player-like entities, can also be controlled by AI, with the underlying behavior being delegated in the same way as if the player were being controlled by the user.

Fixed the issue where, if the player were blocked while moving horizontally, they would remain blocked even if vertical movement were to remove the collision.

Fixed cases of the player animating incorrectly after performing certain movements.
Diffstat (limited to 'src/components/ponderable.h')
-rw-r--r--src/components/ponderable.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/components/ponderable.h b/src/components/ponderable.h index ac759b6..e21cbab 100644 --- a/src/components/ponderable.h +++ b/src/components/ponderable.h
@@ -11,13 +11,6 @@ public:
11 freefalling 11 freefalling
12 }; 12 };
13 13
14 enum class State {
15 grounded,
16 jumping,
17 falling,
18 dropping
19 };
20
21 PonderableComponent(Type type) : type_(type) 14 PonderableComponent(Type type) : type_(type)
22 { 15 {
23 } 16 }
@@ -67,14 +60,14 @@ public:
67 accelY_ = v; 60 accelY_ = v;
68 } 61 }
69 62
70 inline State getState() const 63 inline bool isGrounded() const
71 { 64 {
72 return state_; 65 return grounded_;
73 } 66 }
74 67
75 inline void setState(State arg) 68 inline void setGrounded(bool v)
76 { 69 {
77 state_ = arg; 70 grounded_ = v;
78 } 71 }
79 72
80private: 73private:
@@ -84,7 +77,7 @@ private:
84 double accelX_ = 0.0; 77 double accelX_ = 0.0;
85 double accelY_ = 0.0; 78 double accelY_ = 0.0;
86 Type type_ = Type::vacuumed; 79 Type type_ = Type::vacuumed;
87 State state_ = State::grounded; 80 bool grounded_ = false;
88}; 81};
89 82
90#endif /* end of include guard: TANGIBLE_H_746DB3EE */ 83#endif /* end of include guard: TANGIBLE_H_746DB3EE */