Sign in to follow this  
Demx

cooldown effect

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this