From 62069b31c7d23055f999c70a58ccf7d58acd333f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 20 Dec 2018 18:57:23 -0500 Subject: Added target velocity 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. --- src/systems/playing.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/systems/playing.cpp') 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 @@ #include "components/playable.h" #include "components/controllable.h" #include "components/orientable.h" +#include "components/ponderable.h" #include "systems/mapping.h" #include "systems/pondering.h" #include "systems/orienting.h" @@ -46,6 +47,10 @@ void PlayingSystem::initPlayer() player, PonderableComponent::Type::freefalling); + auto& ponderable = game_.getEntityManager(). + getComponent(player); + ponderable.accel.x() = 720; + game_.getEntityManager().emplaceComponent(player); game_.getEntityManager().emplaceComponent(player); -- cgit 1.4.1