summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2010-12-21 18:00:21 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-12-21 18:00:21 +0000
commitc04ccc9cc3aa91c634880cbfd2d77b58d68189ad (patch)
treeadf3565be9fa62b6c1092e53a621c69e756ad77b /main.cpp
parent610c22ab2bf4ac2c6abbce7991436a910dafe5f6 (diff)
Implement crouching
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 9cd8f37..b6e0a73 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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;
}
}