diff options
author | Joe Robinson <joe@lc8n.com> | 2010-12-21 18:00:21 +0000 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-12-21 18:00:21 +0000 |
commit | c04ccc9cc3aa91c634880cbfd2d77b58d68189ad (patch) | |
tree | adf3565be9fa62b6c1092e53a621c69e756ad77b /main.cpp | |
parent | 610c22ab2bf4ac2c6abbce7991436a910dafe5f6 (diff) |
Implement crouching
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -52,6 +52,11 @@ int main(int argc, char* args[]) { case SDLK_LCTRL: level.player.setSprint(true); break; + case SDLK_DOWN: + // Only crouch if they are not currently crouched + if (level.player.getCrouch() == 0) + level.player.setCrouch(2); + break; } } else if (event.type == SDL_KEYUP) { // Adjust player velocity @@ -67,6 +72,11 @@ int main(int argc, char* args[]) { case SDLK_LCTRL: level.player.setSprint(false); break; + case SDLK_DOWN: + // Attempt to uncrouch, if crouching + if (level.player.getCrouch() == 2) + level.player.setCrouch(1); + break; } } |