diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-24 00:11:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-24 00:11:07 +0300 |
commit | 2aa5e6701cc6bcc18b1f797dba25e4023f604845 (patch) | |
tree | e08789a11163a3768407bf1fb3f82e2e52a31db5 | |
parent | 944aaba6adf16becb8c82efd35df25f8c90e25b5 (diff) | |
download | manaverse-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.gz manaverse-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.bz2 manaverse-2aa5e6701cc6bcc18b1f797dba25e4023f604845.tar.xz manaverse-2aa5e6701cc6bcc18b1f797dba25e4023f604845.zip |
improve rotationalparticle class.
-rw-r--r-- | src/rotationalparticle.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp index 407bcaa56..d3b296587 100644 --- a/src/rotationalparticle.cpp +++ b/src/rotationalparticle.cpp @@ -28,6 +28,7 @@ #include "debug.h" static const double PI = 3.14159265; +static const float PI2 = 2 * 3.14159265; RotationalParticle::RotationalParticle(Map *const map, Animation *const animation) : @@ -64,12 +65,12 @@ bool RotationalParticle::update() float rad = static_cast<float>(atan2(mVelocity.x, mVelocity.y)); if (rad < 0) - rad = static_cast<float>(PI) + static_cast<float>(PI) + rad; + rad = PI2 + rad; const float range = static_cast<const float>(PI / size); // Determines which frame the particle should play - if (rad < range || rad > ((static_cast<float>(PI)*2) - range)) + if (rad < range || rad > PI2 - range) { mAnimation->setFrame(0); } |