Hi there!
In my game, the player can hit the enemy, and then he must wait for a "cooldown" time to hit again. I´m trying to display a graphic (like a clock) to represent the elapsed time.
I have the constant CD time and a
sf::Clock to check the elapsed time since de CD begins
const sf::Time cooldownTime = sf::seconds (0.7f);
sf::Clock elapsedCDTime;
I have the graphic shapes
sf::CircleShape circle (30.0f); // The "clock" shape
circle.setFillColor (sf::Color::Transparent);
circle.setOutlineColor (sf::Color::White);
circle.setOutlineThickness (4.0f);
sf::RectangleShape needle (sf::Vector2f (40.0f, 4.0f)); // The clock "needle"
needle.setFillColor (sf::Color::White);
needle.setRotation (90.0f);
Now, I want the "needle" to start rotating from 90 deg. to give a full turn, clockwise. How can I calculate the needle rotation, based on the elapsed time?
Thanks for your time, and sorry for the bad english