Added bind to swap Gadgets with 'F'.
This commit is contained in:
parent
8bee607981
commit
cb11a22bff
4 changed files with 14 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
|||
void useRightGadget();
|
||||
std::string getLeftGadgetName() const;
|
||||
std::string getRightGadgetName() const;
|
||||
void swapGadgets();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
using Character::getHealth;
|
||||
using Character::getLeftGadgetName;
|
||||
using Character::getRightGadgetName;
|
||||
using Character::swapGadgets;
|
||||
|
||||
private:
|
||||
void onThink(int elapsed) override;
|
||||
|
|
Reference in a new issue