Le joueur ne se met plus à voler en reculant!
This commit is contained in:
parent
55fccd3b2e
commit
fc0dcc2ebd
@ -75,7 +75,7 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
|
|||||||
if (dash) accWS = m_topspeed; // Pour avoir un boost de vitesse vers l'avant si le dash est appuyé seul.
|
if (dash) accWS = m_topspeed; // Pour avoir un boost de vitesse vers l'avant si le dash est appuyé seul.
|
||||||
}
|
}
|
||||||
|
|
||||||
m_position.y += accjmp;
|
m_position.y += accjmp + (sin(gametime) - 0.5f) * ((abs(accWS) + abs(accAD)) / 2.f) / (10.f * m_topspeed);;
|
||||||
|
|
||||||
if (front) {
|
if (front) {
|
||||||
if (dbljump == 0)
|
if (dbljump == 0)
|
||||||
@ -83,7 +83,6 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
|
|||||||
if (dash) accWS *= accWS > 0.f ? 3.f : -1.f;
|
if (dash) accWS *= accWS > 0.f ? 3.f : -1.f;
|
||||||
m_position.x += float(sin(yrotrad)) * elapsedTime * accWS;
|
m_position.x += float(sin(yrotrad)) * elapsedTime * accWS;
|
||||||
m_position.z += float(-cos(yrotrad)) * elapsedTime * accWS;
|
m_position.z += float(-cos(yrotrad)) * elapsedTime * accWS;
|
||||||
m_position.y += (sin(gametime) - 0.5f) * accWS / (20.f * m_topspeed);
|
|
||||||
}
|
}
|
||||||
else if (back) {
|
else if (back) {
|
||||||
if (dbljump == 0)
|
if (dbljump == 0)
|
||||||
@ -91,14 +90,13 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
|
|||||||
if (dash) accWS *= accWS < 0.f? 3.f: -1.f;
|
if (dash) accWS *= accWS < 0.f? 3.f: -1.f;
|
||||||
m_position.x += float(-sin(yrotrad)) * elapsedTime * -accWS;
|
m_position.x += float(-sin(yrotrad)) * elapsedTime * -accWS;
|
||||||
m_position.z += float(cos(yrotrad)) * elapsedTime * -accWS;
|
m_position.z += float(cos(yrotrad)) * elapsedTime * -accWS;
|
||||||
m_position.y += (sin(gametime) - 0.5f) * accWS / (20.f * m_topspeed);
|
|
||||||
}
|
}
|
||||||
else if (accWS != 0) {
|
else if (accWS != 0) {
|
||||||
accWS = accWS > 0 ? accWS - elapsedTime * (m_position.y > 0.f ? 10 : 120) : accWS + elapsedTime * (m_position.y > 0.f ? 10 : 120);
|
accWS = accWS > 0 ? accWS - elapsedTime * (m_position.y > 0.1f ? 10 : 120)
|
||||||
|
: accWS + elapsedTime * (m_position.y > 0.1f ? 10 : 120);
|
||||||
|
|
||||||
m_position.x += float(sin(yrotrad)) * elapsedTime * accWS;
|
m_position.x += float(sin(yrotrad)) * elapsedTime * accWS;
|
||||||
m_position.z += float(-cos(yrotrad)) * elapsedTime * accWS;
|
m_position.z += float(-cos(yrotrad)) * elapsedTime * accWS;
|
||||||
m_position.y += (sin(gametime) - 0.5f) * accWS / (30.f * m_topspeed);
|
|
||||||
if (accWS < 1 && accWS > -1) accWS = 0;
|
if (accWS < 1 && accWS > -1) accWS = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +106,6 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
|
|||||||
if (dash) accAD *= accAD > 0.f? 3.f: -1.f;
|
if (dash) accAD *= accAD > 0.f? 3.f: -1.f;
|
||||||
m_position.x += float(-cos(yrotrad)) * elapsedTime * accAD;
|
m_position.x += float(-cos(yrotrad)) * elapsedTime * accAD;
|
||||||
m_position.z += float(-sin(yrotrad)) * elapsedTime * accAD;
|
m_position.z += float(-sin(yrotrad)) * elapsedTime * accAD;
|
||||||
if (accWS == 0.f) m_position.y += (sin(gametime) - 0.5f) * accAD / (20.f * m_topspeed);
|
|
||||||
}
|
}
|
||||||
else if (right) {
|
else if (right) {
|
||||||
if (dbljump == 0)
|
if (dbljump == 0)
|
||||||
@ -116,13 +113,13 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
|
|||||||
if (dash) accAD *= accAD < 0.f ? 3.f : -1.f;
|
if (dash) accAD *= accAD < 0.f ? 3.f : -1.f;
|
||||||
m_position.x += float(cos(yrotrad)) * elapsedTime * -accAD;
|
m_position.x += float(cos(yrotrad)) * elapsedTime * -accAD;
|
||||||
m_position.z += float(sin(yrotrad)) * elapsedTime * -accAD;
|
m_position.z += float(sin(yrotrad)) * elapsedTime * -accAD;
|
||||||
if (accWS == 0.f) m_position.y += (sin(gametime) - 0.5f) * accAD / (20.f * m_topspeed);
|
|
||||||
}
|
}
|
||||||
else if (accAD != 0) {
|
else if (accAD != 0) {
|
||||||
accAD = accAD > 0 ? accAD - elapsedTime * (m_position.y > 0.f ? 10 : 120) : accAD + elapsedTime * (m_position.y > 0.f ? 10 : 120);
|
accAD = accAD > 0 ? accAD - elapsedTime * (m_position.y > 0.1f ? 10 : 120)
|
||||||
|
: accAD + elapsedTime * (m_position.y > 0.1f ? 10 : 120);
|
||||||
|
|
||||||
m_position.x += float(-cos(yrotrad)) * elapsedTime * accAD;
|
m_position.x += float(-cos(yrotrad)) * elapsedTime * accAD;
|
||||||
m_position.z += float(-sin(yrotrad)) * elapsedTime * accAD;
|
m_position.z += float(-sin(yrotrad)) * elapsedTime * accAD;
|
||||||
if (accWS == 0.f) m_position.y += (sin(gametime) - 0.5f) * accAD / (20.f * m_topspeed);
|
|
||||||
if (accAD < 1 && accAD > -1) accAD = 0;
|
if (accAD < 1 && accAD > -1) accAD = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user