diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-18 15:25:52 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-18 15:25:52 -0500 |
commit | e4e2f2d2a7b6a282b9618aa0004d9453936f43c6 (patch) | |
tree | de1653dc8b5992420147f28d9fb4de052ea1845f /src/systems/controlling.cpp | |
parent | e16fb5be90c889c371cbb0ca2444735c2e12073c (diff) | |
download | therapy-e4e2f2d2a7b6a282b9618aa0004d9453936f43c6.tar.gz therapy-e4e2f2d2a7b6a282b9618aa0004d9453936f43c6.tar.bz2 therapy-e4e2f2d2a7b6a282b9618aa0004d9453936f43c6.zip |
Added player death and event scheduling
Also added ability to make sprites flicker, to freeze physics for an entity, and to freeze progression of a sprite's animation loop.
Diffstat (limited to 'src/systems/controlling.cpp')
-rw-r--r-- | src/systems/controlling.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/systems/controlling.cpp b/src/systems/controlling.cpp index e1609bd..e65c09a 100644 --- a/src/systems/controlling.cpp +++ b/src/systems/controlling.cpp | |||
@@ -105,3 +105,32 @@ void ControllingSystem::input(int key, int action) | |||
105 | { | 105 | { |
106 | actions_.push(std::make_pair(key, action)); | 106 | actions_.push(std::make_pair(key, action)); |
107 | } | 107 | } |
108 | |||
109 | void ControllingSystem::freeze(id_type entity) | ||
110 | { | ||
111 | auto& controllable = game_.getEntityManager(). | ||
112 | getComponent<ControllableComponent>(entity); | ||
113 | |||
114 | controllable.setFrozen(true); | ||
115 | } | ||
116 | |||
117 | void ControllingSystem::unfreeze(id_type entity) | ||
118 | { | ||
119 | auto& controllable = game_.getEntityManager(). | ||
120 | getComponent<ControllableComponent>(entity); | ||
121 | |||
122 | if (controllable.isFrozen()) | ||
123 | { | ||
124 | controllable.setFrozen(false); | ||
125 | |||
126 | auto& orienting = game_.getSystemManager().getSystem<OrientingSystem>(); | ||
127 | |||
128 | if (controllable.isHoldingLeft()) | ||
129 | { | ||
130 | orienting.moveLeft(entity); | ||
131 | } else if (controllable.isHoldingRight()) | ||
132 | { | ||
133 | orienting.moveRight(entity); | ||
134 | } | ||
135 | } | ||
136 | } | ||