From 0d99c20d0fafcf2b86d9d33430659de76b030395 Mon Sep 17 00:00:00 2001 From: cflip Date: Thu, 24 Mar 2022 08:45:00 -0600 Subject: Add acceleration/deceleration to the train --- src/train.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/train.cpp') 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(); } -- cgit v1.2.3