Restore crosshair position after player death.

This commit is contained in:
Felix Ableitner 2013-08-18 13:38:28 +02:00
parent b5514b6af9
commit 384ab6c486
3 changed files with 8 additions and 0 deletions

View file

@ -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);

View file

@ -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.
*

View file

@ -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;