aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.cpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <abelleisle@protonmail.com>2022-11-13 14:17:29 -0600
committerAndy Belle-Isle <abelleisle@protonmail.com>2022-11-13 14:17:29 -0600
commit8254af1179db18e2a71c34ab9b7090cda16f0f07 (patch)
tree50a2e5fe2cccbac0c5141a4dc4c713e3dc533573 /src/player.cpp
parent38e2036d031bdeaea76ef4b6c3c2af5247ed93ec (diff)
Added crouch keyworld
* This allows players to move 2D to test collision
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/player.cpp b/src/player.cpp
index f40a1d1..1f950df 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -71,6 +71,12 @@ void PlayerSystem::receive(const KeyDownEvent& kue)
el.tryListener("JumpKeyPressed",
e.component<Scripted>()->caller);
});
+ } else if (kue.sym == SDLK_LSHIFT) {
+ entities.each<EventListener>(
+ [](entityx::Entity e, EventListener& el) {
+ el.tryListener("CrouchKeyPressed",
+ e.component<Scripted>()->caller);
+ });
}
}
}
@@ -96,6 +102,12 @@ void PlayerSystem::receive(const KeyUpEvent& kue)
el.tryListener("JumpKeyReleased",
e.component<Scripted>()->caller);
});
+ } else if (kue.sym == SDLK_LSHIFT) {
+ entities.each<EventListener>(
+ [](entityx::Entity e, EventListener& el) {
+ el.tryListener("CrouchKeyReleased",
+ e.component<Scripted>()->caller);
+ });
}
}
}