diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-08 21:09:36 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-09 17:59:13 -0400 |
commit | 5c82f052c26303318e81ddd76475c1d188cc74f4 (patch) | |
tree | 3204ef94f2861224a380aa566728c02b4acd1fd9 /src/systems/orienting.cpp | |
parent | 96e6f3231aed9919d660a06944f1d96dc8241f8e (diff) | |
download | therapy-5c82f052c26303318e81ddd76475c1d188cc74f4.tar.gz therapy-5c82f052c26303318e81ddd76475c1d188cc74f4.tar.bz2 therapy-5c82f052c26303318e81ddd76475c1d188cc74f4.zip |
Simplified positions/sizes with vectors
Positions and sizes are now stored as vectors (of doubles and ints, respectively). This allows for at least minor code simplification in many places, and cleans up the CollisionParams code in PonderingSystem quite a bit.
Diffstat (limited to 'src/systems/orienting.cpp')
-rw-r--r-- | src/systems/orienting.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/systems/orienting.cpp b/src/systems/orienting.cpp index 206ebf6..d73ddd2 100644 --- a/src/systems/orienting.cpp +++ b/src/systems/orienting.cpp | |||
@@ -24,27 +24,27 @@ void OrientingSystem::tick(double) | |||
24 | { | 24 | { |
25 | case OrientableComponent::WalkState::still: | 25 | case OrientableComponent::WalkState::still: |
26 | { | 26 | { |
27 | ponderable.velX = 0.0; | 27 | ponderable.vel.x() = 0.0; |
28 | 28 | ||
29 | break; | 29 | break; |
30 | } | 30 | } |
31 | 31 | ||
32 | case OrientableComponent::WalkState::left: | 32 | case OrientableComponent::WalkState::left: |
33 | { | 33 | { |
34 | ponderable.velX = -WALK_SPEED; | 34 | ponderable.vel.x() = -WALK_SPEED; |
35 | 35 | ||
36 | break; | 36 | break; |
37 | } | 37 | } |
38 | 38 | ||
39 | case OrientableComponent::WalkState::right: | 39 | case OrientableComponent::WalkState::right: |
40 | { | 40 | { |
41 | ponderable.velX = WALK_SPEED; | 41 | ponderable.vel.x() = WALK_SPEED; |
42 | 42 | ||
43 | break; | 43 | break; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | if (orientable.isJumping() && (ponderable.velY > 0)) | 47 | if (orientable.isJumping() && (ponderable.vel.y() > 0)) |
48 | { | 48 | { |
49 | orientable.setJumping(false); | 49 | orientable.setJumping(false); |
50 | } | 50 | } |
@@ -122,8 +122,8 @@ void OrientingSystem::jump(id_type entity) | |||
122 | 122 | ||
123 | playSound("res/Randomize87.wav", 0.25); | 123 | playSound("res/Randomize87.wav", 0.25); |
124 | 124 | ||
125 | ponderable.velY = JUMP_VELOCITY; | 125 | ponderable.vel.y() = JUMP_VELOCITY; |
126 | ponderable.accelY = JUMP_GRAVITY; | 126 | ponderable.accel.y() = JUMP_GRAVITY; |
127 | 127 | ||
128 | auto& animating = game_.getSystemManager().getSystem<AnimatingSystem>(); | 128 | auto& animating = game_.getSystemManager().getSystem<AnimatingSystem>(); |
129 | if (orientable.isFacingRight()) | 129 | if (orientable.isFacingRight()) |
@@ -147,7 +147,7 @@ void OrientingSystem::stopJumping(id_type entity) | |||
147 | auto& ponderable = game_.getEntityManager(). | 147 | auto& ponderable = game_.getEntityManager(). |
148 | getComponent<PonderableComponent>(entity); | 148 | getComponent<PonderableComponent>(entity); |
149 | 149 | ||
150 | ponderable.accelY = NORMAL_GRAVITY; | 150 | ponderable.accel.y() = NORMAL_GRAVITY; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||