Jump to content
  • Advertisement
Sign in to follow this  
Demx

cooldown effect

This topic is 2229 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey,
i was wondering how to make the cooldown effect used in games like wow after you use an ability
does anone have an idea using c++ ?

Share this post


Link to post
Share on other sites
Advertisement
The simplest method is to associate a "cooldown counter" to the ability/feature. It can represent the percentage value of the cooldown.

You check when you update the game. If the cooldown counter is 100% full, you can use the ability. If you use the ability (and the counter is at 100% of course), set the cooldown counter to zero, and in every update, increase the counter with a time dependent value until it reaches 100 again.
You can even use this percentage value to render the cooldown effect.


Details depend very heavily the actual implementation of the game (even based of continuously updated, etc.) Edited by szecs

Share this post


Link to post
Share on other sites
Or, a simplified method would be to associate a time the ability can be executed, in Milliseconds. So, once the player uses the ability, you add the current time to the cooldown time, and store it as the cooldown counter. Then, that ability can't be used until the current time is at or past the cooldown time.

szecs method is good for displaying on-screen how much time is left for that cooldown, but it adds more complexity to the implementation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!