From 2aa5e6701cc6bcc18b1f797dba25e4023f604845 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 24 Mar 2013 00:11:07 +0300 Subject: improve rotationalparticle class. --- src/rotationalparticle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/rotationalparticle.cpp') 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(atan2(mVelocity.x, mVelocity.y)); if (rad < 0) - rad = static_cast(PI) + static_cast(PI) + rad; + rad = PI2 + rad; const float range = static_cast(PI / size); // Determines which frame the particle should play - if (rad < range || rad > ((static_cast(PI)*2) - range)) + if (rad < range || rad > PI2 - range) { mAnimation->setFrame(0); } -- cgit v1.2.3-60-g2f50