diff options
author | cflip <cflip@cflip.net> | 2022-02-27 10:08:02 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-02-27 10:11:55 -0700 |
commit | 5aba1f0f337679467c18cddbcbd2ed3f378a1229 (patch) | |
tree | 924e389fbe3fa683563168bf98adab33e8c5b77b /src/train.h | |
parent | 000fb3cf7d5df09f9c89f619a870aecf28b82ce2 (diff) |
Make train movement smoother
Diffstat (limited to 'src/train.h')
-rw-r--r-- | src/train.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/train.h b/src/train.h index 342c787..05b0da5 100644 --- a/src/train.h +++ b/src/train.h @@ -13,15 +13,22 @@ class Level; class TrainCar { public: - TrainCar(int x, int y) - : x(x), y(y), m_sprite("../res/car.png") {} + TrainCar() + : m_sprite("../res/car.png") {} void update(Level&); void draw(Bitmap&, int, int); - int x, y; + void setPosition(int x, int y); private: + void nextTile(); + Bitmap m_sprite; - int m_progress{ 0 }; + + int x{0}, y{0}; + float m_speed{0.05f}; + float m_progress{ 0.f }; + CarDirection m_dir{ North }; + int m_nextX{0}, m_nextY{0}; }; |