diff options
author | cflip <cflip@cflip.net> | 2022-02-27 16:44:34 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-02-27 16:44:34 -0700 |
commit | 30ccec86993d9f9263a9b41314638298bc8e4410 (patch) | |
tree | 04519bae1997e2a81182edfe9a7c43e2720486c8 | |
parent | f9441c46416e2ff6d58ce9df320fa8cc9f2bcf90 (diff) |
Add sprite for east-west moving train car
-rw-r--r-- | res/car.png | bin | 259 -> 307 bytes | |||
-rw-r--r-- | src/train.cpp | 6 |
2 files changed, 5 insertions, 1 deletions
diff --git a/res/car.png b/res/car.png Binary files differindex ae7c6ff..478cbb1 100644 --- a/res/car.png +++ b/res/car.png diff --git a/src/train.cpp b/src/train.cpp index 06c43b2..98a493f 100644 --- a/src/train.cpp +++ b/src/train.cpp @@ -23,7 +23,11 @@ void Train::draw(Bitmap& bitmap, int xo, int yo) float yi = ((float)y + (float)(m_nextY - y) * m_progress) * TileSize; int xx = (int)((xi - yi) / 2.f - (float)xo); int yy = (int)((xi + yi) / 4.f - (float)yo); - bitmap.blit(m_sprite, xx, yy, 0, 0, TileSize, TileSize); + + int tx = 0; + if (m_dir == East || m_dir == West) tx = 24; + + bitmap.blit(m_sprite, xx, yy, tx, 0, TileSize, TileSize); } void Train::setPosition(int tx, int ty) |