Restore crosshair position after player death.
This commit is contained in:
parent
b5514b6af9
commit
384ab6c486
3 changed files with 8 additions and 0 deletions
|
@ -74,8 +74,10 @@ Game::loop() {
|
|||
|
||||
mWorld.think(elapsed);
|
||||
if (mPlayer->getHealth() == 0) {
|
||||
Vector2f pos = mPlayer->getCrosshairPosition();
|
||||
mWorld.remove(mPlayer);
|
||||
initPlayer();
|
||||
mPlayer->setCrosshairPosition(pos);
|
||||
}
|
||||
|
||||
mWorld.step(elapsed);
|
||||
|
|
|
@ -21,6 +21,11 @@ Player::Player(World& world, Pathfinder& pathfinder,
|
|||
mDirection(0) {
|
||||
}
|
||||
|
||||
Vector2f
|
||||
Player::getCrosshairPosition() const {
|
||||
return mCrosshairPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the point where to look and shoot at.
|
||||
*
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
explicit Player(World& world, Pathfinder& pathfinder,
|
||||
const Vector2f& position);
|
||||
|
||||
Vector2f getCrosshairPosition() const;
|
||||
void setCrosshairPosition(const Vector2f& position);
|
||||
using Character::pullTrigger;
|
||||
using Character::releaseTrigger;
|
||||
|
|
Reference in a new issue