diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-07 01:14:36 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-07 01:14:36 -0400 |
commit | 25256900e7c228ff2216cfc515599d5541844d2b (patch) | |
tree | 7cb4bdb8eb0724c8c5af17354588cb32f2ce3041 | |
parent | b0d7712fa08aefa2694b629037eeed2c170b1eab (diff) |
Added jumping support to the player
-rw-r--r-- | src/player.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp index 5346a24..b914672 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -67,6 +67,13 @@ void PlayerSystem::receive(const KeyDownEvent& kue) el.tryListener("MoveRightPressed", e.component<Scripted>()->caller); }); + } else if (kue.sym == SDLK_SPACE) { + entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, + EventListener& el) + { + el.tryListener("JumpKeyPressed", + e.component<Scripted>()->caller); + }); } } } @@ -88,6 +95,13 @@ void PlayerSystem::receive(const KeyUpEvent& kue) el.tryListener("MoveRightReleased", e.component<Scripted>()->caller); }); + } else if (kue.sym == SDLK_SPACE) { + entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, + EventListener& el) + { + el.tryListener("JumpKeyReleased", + e.component<Scripted>()->caller); + }); } } } |