From 25256900e7c228ff2216cfc515599d5541844d2b Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Sat, 7 Sep 2019 01:14:36 -0400 Subject: Added jumping support to the player --- src/player.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/player.cpp') 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()->caller); }); + } else if (kue.sym == SDLK_SPACE) { + entities.each([&]([[maybe_unused]] entityx::Entity e, + EventListener& el) + { + el.tryListener("JumpKeyPressed", + e.component()->caller); + }); } } } @@ -88,6 +95,13 @@ void PlayerSystem::receive(const KeyUpEvent& kue) el.tryListener("MoveRightReleased", e.component()->caller); }); + } else if (kue.sym == SDLK_SPACE) { + entities.each([&]([[maybe_unused]] entityx::Entity e, + EventListener& el) + { + el.tryListener("JumpKeyReleased", + e.component()->caller); + }); } } } -- cgit v1.2.3