summary refs log tree commit diff stats
path: root/src/systems/playing.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-12-20 18:57:23 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-12-20 18:57:23 -0500
commit62069b31c7d23055f999c70a58ccf7d58acd333f (patch)
tree7ea4c57e74d978a297d34cf61d9c85db846e8900 /src/systems/playing.cpp
parent90aadf3844386824140a20d7fbb847bc16009a94 (diff)
downloadtherapy-master.tar.gz
therapy-master.tar.bz2
therapy-master.zip
Added target velocity HEAD master
The acceleration of a Ponderable entity is now only really a magnitude. The direction of acceleration is such that the velocity goes toward the target velocity. If accelerating would cause the velocity to pass the target velocity, it is instead set to the target.

This is currently being used to 1) generalize terminal velocity due to gravity, and 2) allow an Orientable entity to accelerate quickly to a walking speed (and to a halt) rather than instantly achieve it.
Diffstat (limited to 'src/systems/playing.cpp')
-rw-r--r--src/systems/playing.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systems/playing.cpp b/src/systems/playing.cpp index 6652099..83f65d6 100644 --- a/src/systems/playing.cpp +++ b/src/systems/playing.cpp
@@ -5,6 +5,7 @@
5#include "components/playable.h" 5#include "components/playable.h"
6#include "components/controllable.h" 6#include "components/controllable.h"
7#include "components/orientable.h" 7#include "components/orientable.h"
8#include "components/ponderable.h"
8#include "systems/mapping.h" 9#include "systems/mapping.h"
9#include "systems/pondering.h" 10#include "systems/pondering.h"
10#include "systems/orienting.h" 11#include "systems/orienting.h"
@@ -46,6 +47,10 @@ void PlayingSystem::initPlayer()
46 player, 47 player,
47 PonderableComponent::Type::freefalling); 48 PonderableComponent::Type::freefalling);
48 49
50 auto& ponderable = game_.getEntityManager().
51 getComponent<PonderableComponent>(player);
52 ponderable.accel.x() = 720;
53
49 game_.getEntityManager().emplaceComponent<ControllableComponent>(player); 54 game_.getEntityManager().emplaceComponent<ControllableComponent>(player);
50 game_.getEntityManager().emplaceComponent<OrientableComponent>(player); 55 game_.getEntityManager().emplaceComponent<OrientableComponent>(player);
51 56