diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-19 10:45:04 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-02-19 10:45:04 -0500 |
commit | dbc486d5cc0fa6b7cdb690fb4591f292d33e9ecc (patch) | |
tree | f702916de344abce394c967aba8cc910ba7cb093 | |
parent | e4e2f2d2a7b6a282b9618aa0004d9453936f43c6 (diff) | |
download | therapy-dbc486d5cc0fa6b7cdb690fb4591f292d33e9ecc.tar.gz therapy-dbc486d5cc0fa6b7cdb690fb4591f292d33e9ecc.tar.bz2 therapy-dbc486d5cc0fa6b7cdb690fb4591f292d33e9ecc.zip |
Added freefalling terminal velocity
-rw-r--r-- | src/consts.h | 1 | ||||
-rw-r--r-- | src/systems/pondering.cpp | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/consts.h b/src/consts.h index a065159..f3f777f 100644 --- a/src/consts.h +++ b/src/consts.h | |||
@@ -22,5 +22,6 @@ const double JUMP_GRAVITY = CALC_GRAVITY(TILE_HEIGHT*4.5, 0.3); | |||
22 | const double JUMP_VELOCITY = CALC_VELOCITY(TILE_HEIGHT*4.5, 0.3); | 22 | const double JUMP_VELOCITY = CALC_VELOCITY(TILE_HEIGHT*4.5, 0.3); |
23 | 23 | ||
24 | const double WALK_SPEED = 90; | 24 | const double WALK_SPEED = 90; |
25 | const double TERMINAL_VELOCITY = 240; | ||
25 | 26 | ||
26 | #endif | 27 | #endif |
diff --git a/src/systems/pondering.cpp b/src/systems/pondering.cpp index d3601ac..02d5cfc 100644 --- a/src/systems/pondering.cpp +++ b/src/systems/pondering.cpp | |||
@@ -39,6 +39,12 @@ void PonderingSystem::tick(double dt) | |||
39 | ponderable.setVelocityY( | 39 | ponderable.setVelocityY( |
40 | ponderable.getVelocityY() + ponderable.getAccelY() * dt); | 40 | ponderable.getVelocityY() + ponderable.getAccelY() * dt); |
41 | 41 | ||
42 | if ((ponderable.getType() == PonderableComponent::Type::freefalling) | ||
43 | && (ponderable.getVelocityY() > TERMINAL_VELOCITY)) | ||
44 | { | ||
45 | ponderable.setVelocityY(TERMINAL_VELOCITY); | ||
46 | } | ||
47 | |||
42 | const double oldX = transformable.getX(); | 48 | const double oldX = transformable.getX(); |
43 | const double oldY = transformable.getY(); | 49 | const double oldY = transformable.getY(); |
44 | const double oldRight = oldX + transformable.getW(); | 50 | const double oldRight = oldX + transformable.getW(); |