GL - Player dies and respawns
This commit is contained in:
parent
1f28c05983
commit
3bf9f59f5a
|
@ -35,7 +35,7 @@ using namespace GameLogic;
|
|||
//return Physics::ICustomBody::SubscriptMessage_none;
|
||||
break;
|
||||
case OBJECT_TYPE::OBJECT_TYPE_WORLD:
|
||||
int test = 5;
|
||||
PlayerVObject(*player,*realObj, kineticEnergyLoss);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ Player::~Player(void)
|
|||
void Player::BeginFrame()
|
||||
{
|
||||
weapon->Update(0.002f);
|
||||
if(playerState == PLAYER_STATE_DEAD) Respawn(Oyster::Math::Float3(0,308,0));
|
||||
Object::BeginFrame();
|
||||
}
|
||||
|
||||
|
@ -132,6 +133,7 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
|||
this->life = 100;
|
||||
this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||
this->lookDir = Oyster::Math::Float4(1,0,0);
|
||||
this->setState.SetCenterPosition(spawnPoint);
|
||||
}
|
||||
|
||||
void Player::Rotate(const Oyster::Math3D::Float4 lookDir)
|
||||
|
@ -187,5 +189,13 @@ PLAYER_STATE Player::GetState() const
|
|||
void Player::DamageLife(int damage)
|
||||
{
|
||||
this->life -= damage;
|
||||
this->life = 0;
|
||||
|
||||
if(this->life <= 0)
|
||||
{
|
||||
this->life = 0;
|
||||
playerState = PLAYER_STATE_DEAD;
|
||||
//do stuff that makes you dead
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue