Added bind to swap Gadgets with 'F'.

This commit is contained in:
Felix Ableitner 2013-07-13 00:01:57 +02:00
parent 8bee607981
commit cb11a22bff
4 changed files with 14 additions and 3 deletions

View file

@ -172,6 +172,9 @@ Game::keyUp(const sf::Event& event) {
case sf::Keyboard::D:
mPlayer->setDirection(Player::Direction::RIGHT, true);
break;
case sf::Keyboard::F:
mPlayer->swapGadgets();
break;
default:
break;
}

View file

@ -220,6 +220,12 @@ Character::selectSecondWeapon() {
mActiveWeapon = mSecondWeapon;
}
int
Character::getHealth() const {
return mCurrentHealth;
}
void
Character::setLeftGadget(std::shared_ptr<Gadget> gadget) {
mLeftGadget = gadget;
@ -250,7 +256,7 @@ Character::getRightGadgetName() const {
return mRightGadget->getName();
}
int
Character::getHealth() const {
return mCurrentHealth;
void
Character::swapGadgets() {
std::swap(mLeftGadget, mRightGadget);
}

View file

@ -63,6 +63,7 @@ protected:
void useRightGadget();
std::string getLeftGadgetName() const;
std::string getRightGadgetName() const;
void swapGadgets();
protected:

View file

@ -50,6 +50,7 @@ public:
using Character::getHealth;
using Character::getLeftGadgetName;
using Character::getRightGadgetName;
using Character::swapGadgets;
private:
void onThink(int elapsed) override;