diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-12 12:09:58 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-12 12:09:58 -0500 |
commit | be9ccb73bc20b03f62c77f5d529602a10ef4eda9 (patch) | |
tree | 6f88a9b780a75e52b2f04b6f61167f4ef46590a7 /src/main.cpp | |
parent | c1a88a064a0cddbc1df2e716ef2102d22bbf681b (diff) | |
download | ether-be9ccb73bc20b03f62c77f5d529602a10ef4eda9.tar.gz ether-be9ccb73bc20b03f62c77f5d529602a10ef4eda9.tar.bz2 ether-be9ccb73bc20b03f62c77f5d529602a10ef4eda9.zip |
player has a sprite now thanks to world of solaria
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1805357..5178110 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -207,6 +207,7 @@ bool processKeys(Game& game, const Input& keystate) | |||
207 | { | 207 | { |
208 | int px = game.player_x; | 208 | int px = game.player_x; |
209 | int py = game.player_y; | 209 | int py = game.player_y; |
210 | Direction dir = Direction::up; | ||
210 | 211 | ||
211 | if (keystate.up) | 212 | if (keystate.up) |
212 | { | 213 | { |
@@ -216,20 +217,26 @@ bool processKeys(Game& game, const Input& keystate) | |||
216 | if (keystate.down) | 217 | if (keystate.down) |
217 | { | 218 | { |
218 | py++; | 219 | py++; |
220 | dir = Direction::down; | ||
219 | } | 221 | } |
220 | 222 | ||
221 | if (keystate.left) | 223 | if (keystate.left) |
222 | { | 224 | { |
223 | px--; | 225 | px--; |
226 | dir = Direction::left; | ||
224 | } | 227 | } |
225 | 228 | ||
226 | if (keystate.right) | 229 | if (keystate.right) |
227 | { | 230 | { |
228 | px++; | 231 | px++; |
232 | dir = Direction::right; | ||
229 | } | 233 | } |
230 | 234 | ||
231 | if (!(game.player_x == px && game.player_y == py)) | 235 | if (!(game.player_x == px && game.player_y == py)) |
232 | { | 236 | { |
237 | game.playerAnim.setAnimation("walk"); | ||
238 | game.playerAnim.setDirection(dir); | ||
239 | |||
233 | return movePlayer(game, px, py); | 240 | return movePlayer(game, px, py); |
234 | } else { | 241 | } else { |
235 | return false; | 242 | return false; |
@@ -614,6 +621,8 @@ int main(int, char**) | |||
614 | { | 621 | { |
615 | game.firstInput = true; | 622 | game.firstInput = true; |
616 | game.lastInput = keystate; | 623 | game.lastInput = keystate; |
624 | } else if (losing == LoseState::None) { | ||
625 | game.playerAnim.setAnimation("still"); | ||
617 | } | 626 | } |
618 | 627 | ||
619 | dustAcc += frameTime; | 628 | dustAcc += frameTime; |
@@ -767,6 +776,8 @@ int main(int, char**) | |||
767 | zoomAcc -= zoomDt; | 776 | zoomAcc -= zoomDt; |
768 | } | 777 | } |
769 | 778 | ||
779 | game.playerAnim.update(frameTime); | ||
780 | |||
770 | game.muxer.update(); | 781 | game.muxer.update(); |
771 | renderer.render(game, true); | 782 | renderer.render(game, true); |
772 | } | 783 | } |