diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-19 21:24:36 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-19 21:24:36 +0000 |
commit | 7ac7d0e030464f744546b4e6183a7242f640d5d3 (patch) | |
tree | f19831b29511d46e8aba45ace6017c8e6afe815b /src/game.cpp | |
parent | b7cfcffd7a156e19dfa9882d67426f4fa6edef57 (diff) | |
download | mana-7ac7d0e030464f744546b4e6183a7242f640d5d3.tar.gz mana-7ac7d0e030464f744546b4e6183a7242f640d5d3.tar.bz2 mana-7ac7d0e030464f744546b4e6183a7242f640d5d3.tar.xz mana-7ac7d0e030464f744546b4e6183a7242f640d5d3.zip |
Separated sprite definition from playback.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp index ba65298f..7da80069 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -86,7 +86,7 @@ bool done = false; volatile int tick_time; volatile int fps = 0, frame = 0; Engine *engine = NULL; -Joystick *joystick; +Joystick *joystick = NULL; extern Window *weightNotice; extern Window *deathNotice; @@ -650,35 +650,35 @@ void Game::handleInput() { Uint16 x = player_node->mX; Uint16 y = player_node->mY; - unsigned char Direction = 0; + unsigned char direction = 0; // Translate pressed keys to movement and direction if (keys[SDLK_UP] || keys[SDLK_KP8] || keys[SDLK_KP7] || keys[SDLK_KP9] || joystick && joystick->isUp()) { - Direction |= Being::UP; + direction |= Being::UP; } else if (keys[SDLK_DOWN] || keys[SDLK_KP2] || keys[SDLK_KP1] || keys[SDLK_KP3] || joystick && joystick->isDown()) { - Direction |= Being::DOWN; + direction |= Being::DOWN; } if (keys[SDLK_LEFT] || keys[SDLK_KP4] || keys[SDLK_KP1] || keys[SDLK_KP7] || joystick && joystick->isLeft()) { - Direction |= Being::LEFT; + direction |= Being::LEFT; } else if (keys[SDLK_RIGHT] || keys[SDLK_KP6] || keys[SDLK_KP3] || keys[SDLK_KP9] || joystick && joystick->isRight()) { - Direction |= Being::RIGHT; + direction |= Being::RIGHT; } - player_node->walk(Direction); + player_node->walk(direction); // Attacking monsters if (keys[SDLK_LCTRL] || keys[SDLK_RCTRL] || |