booster fonctionnel
manque la distribution booster sur la map
This commit is contained in:
@@ -198,7 +198,7 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi
|
||||
else isStep = false;
|
||||
m_POV = m_position.y;
|
||||
m_POV += m_airborne ? 0 : (sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) * .2f;
|
||||
TakeBooster(booster_table);
|
||||
TakeBooster(booster_table, elapsedTime);
|
||||
RemoveBooster(elapsedTime);
|
||||
return snd;
|
||||
}
|
||||
@@ -212,20 +212,22 @@ void Player::ApplyTransformation(Transformation& transformation, bool rel, bool
|
||||
if (rel) transformation.ApplyTranslation(-GetPOV());
|
||||
}
|
||||
|
||||
void Player::TakeBooster(Booster booster_table[])
|
||||
void Player::TakeBooster(Booster booster_table[], float elapsedtime)
|
||||
{
|
||||
Vector3f playerpos = GetPosition();
|
||||
for (int i = 0; i < sizeof(booster_table); i++)
|
||||
{
|
||||
Vector3f pos = booster_table[i].GetPosition();
|
||||
if (abs((m_position.x + m_position.y + m_position.z) - (pos.x + pos.y +pos.z)) <= 0.5f && booster_table[i].GetAvailability() == true)
|
||||
if (abs(playerpos.x - pos.x) <= 0.5f && abs(playerpos.y - pos.y) <= 1.0f && abs(playerpos.z - pos.z) <= 0.5f && booster_table[i].GetAvailability() == true)
|
||||
{
|
||||
GetBooster(booster_table[i].GetType());
|
||||
GetBooster(booster_table[i].GetType(), elapsedtime);
|
||||
booster_table[i].SetAvailability(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::GetBooster(BOOST_TYPE boosttype)
|
||||
void Player::GetBooster(BOOST_TYPE boosttype, float elapsedtime)
|
||||
{
|
||||
if (boosttype == BTYPE_SPEED)
|
||||
{
|
||||
@@ -234,7 +236,7 @@ void Player::GetBooster(BOOST_TYPE boosttype)
|
||||
}
|
||||
if (boosttype == BTYPE_HEAL)
|
||||
{
|
||||
m_hp = 100;
|
||||
m_hp = 1.0f;
|
||||
}
|
||||
if (boosttype == BTYPE_DAMAGE)
|
||||
{
|
||||
@@ -252,19 +254,17 @@ void Player::RemoveBooster(float elapsedtime)
|
||||
if (boostspeed)
|
||||
{
|
||||
timeboostspeed += elapsedtime;
|
||||
if (timeboostspeed >= TIME_SPEED_BOOST)
|
||||
if (timeboostspeed >= TIME_SPEED_BOOST && boostspeed == true)
|
||||
boostspeed = false;
|
||||
}
|
||||
if (boostdamage)
|
||||
{
|
||||
timeboostdamage += elapsedtime;
|
||||
if (timeboostdamage >= TIME_DAMAGE_BOOST)
|
||||
if (timeboostdamage >= TIME_DAMAGE_BOOST && boostdamage == true)
|
||||
boostdamage = false;
|
||||
}
|
||||
if (boostinvincible)
|
||||
{
|
||||
timeboostinvincible += elapsedtime;
|
||||
if (timeboostinvincible >= TIME_INVINCIBLE_BOOST)
|
||||
if (timeboostinvincible >= TIME_INVINCIBLE_BOOST && boostinvincible == true)
|
||||
boostinvincible = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user