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++ ?
cooldown effect
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.)
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.)
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.
szecs method is good for displaying on-screen how much time is left for that cooldown, but it adds more complexity to the implementation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement