summaryrefslogtreecommitdiff
path: root/src/train.cpp
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-03-24 08:45:00 -0600
committercflip <cflip@cflip.net>2022-03-24 08:45:33 -0600
commit0d99c20d0fafcf2b86d9d33430659de76b030395 (patch)
tree9a84c26683dcc7ddb09433d4bac5a0ff872c9189 /src/train.cpp
parent31d273c11bfd83a490ca538ba67d0a75f1d22cd7 (diff)
Add acceleration/deceleration to the train
Diffstat (limited to 'src/train.cpp')
-rw-r--r--src/train.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/train.cpp b/src/train.cpp
index 7ce1c2d..d3ea7fb 100644
--- a/src/train.cpp
+++ b/src/train.cpp
@@ -14,6 +14,7 @@ void Train::update()
return;
}
+ m_speed *= m_acceleration;
if (m_progress < 1.f) {
m_progress += m_speed;
return;
@@ -48,8 +49,8 @@ void Train::setPosition(int tx, int ty)
{
x = tx;
y = ty;
-
m_progress = 0.f;
+
findDirection();
findNextTile();
}