From 6dcc65e9c96a09cc6531438404bbc72b7d49ad9c Mon Sep 17 00:00:00 2001 From: Rtch90 <ritchie.cunningham@protonmail.com> Date: Thu, 12 Apr 2012 22:32:38 +0100 Subject: [PATCH] [Add] You can run with shift now. --- src/Actor/Player.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Actor/Player.cpp b/src/Actor/Player.cpp index 8c51999..49271af 100644 --- a/src/Actor/Player.cpp +++ b/src/Actor/Player.cpp @@ -4,7 +4,7 @@ #include "../Sound/SoundEffect.h" Player::Player(void) { - PLAYER_SPEED = 15; + PLAYER_SPEED = 5; _rotationAngle = 0.0f; _player = new Sprite(); _player->LoadSprite("../Data/Img/Player.png"); @@ -55,6 +55,15 @@ void Player::ProcessEvents(void) { x += PLAYER_SPEED; _player->SetX(x); } + if(KeyDown(SDLK_LSHIFT)) { + // Run! + PLAYER_SPEED += 3; + Debug::logger->message("Speed: %f", PLAYER_SPEED); + } + if(KeyUp(SDLK_LSHIFT)) { + PLAYER_SPEED -= 2; + Debug::logger->message("Speed: %f", PLAYER_SPEED); + } if(x != oldX || y != oldY) { if(!SoundEffect::IsPlaying(1)) { int sfxIndex;